clean code refactorings

- add description to assertions in unit tests
- make inner classes static
- remove out-commented code

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
Michael Hirsch
2016-02-25 14:38:25 +01:00
parent ca66932918
commit f969d6f4c2
10 changed files with 99 additions and 122 deletions

View File

@@ -99,52 +99,6 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
return new ResponseEntity<>(SoftwareModuleMapper.artifactsToResponse(module.getArtifacts()), HttpStatus.OK);
}
/**
* Handles the GET request for downloading an artifact.
*
* @param softwareModuleId
* of the parent SoftwareModule
* @param artifactId
* of the related LocalArtifact
* @param servletResponse
* of the servlet
* @param request
* of the client
*
* @return responseEntity with status ok if successful
*/
// @RequestMapping(method = RequestMethod.GET, value =
// RestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING
// + "/{softwareModuleId}/artifacts/{artifactId}/download")
// @ResponseBody
// public ResponseEntity<Void> downloadArtifact(@PathVariable final Long
// softwareModuleId,
// @PathVariable final Long artifactId, final HttpServletResponse
// servletResponse,
// final HttpServletRequest request) {
// final SoftwareModule module =
// findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, artifactId);
//
// if (null == module || !module.getLocalArtifact(artifactId).isPresent()) {
// return new ResponseEntity<>(HttpStatus.NOT_FOUND);
// }
//
// final LocalArtifact artifact = module.getLocalArtifact(artifactId).get();
// final DbArtifact file =
// artifactManagement.loadLocalArtifactBinary(artifact);
//
// final String ifMatch = request.getHeader("If-Match");
// if (ifMatch != null &&
// !RestResourceConversionHelper.matchesHttpHeader(ifMatch,
// artifact.getSha1Hash())) {
// return new ResponseEntity<>(HttpStatus.PRECONDITION_FAILED);
// }
//
// return RestResourceConversionHelper.writeFileResponse(artifact,
// servletResponse, request, file);
//
// }
@Override
public ResponseEntity<ArtifactRest> getArtifact(@PathVariable final Long softwareModuleId,
@PathVariable final Long artifactId) {

View File

@@ -32,10 +32,15 @@ public class ExceptionInfoTest {
underTest.setMessage(knownMessage);
underTest.setParameters(knownParameters);
assertThat(underTest.getErrorCode()).isEqualTo(knownErrorCode);
assertThat(underTest.getExceptionClass()).isEqualTo(knownExceptionClass);
assertThat(underTest.getMessage()).isEqualTo(knownMessage);
assertThat(underTest.getParameters()).isEqualTo(knownParameters);
assertThat(underTest.getErrorCode()).as("The error code should match with the known error code in the test")
.isEqualTo(knownErrorCode);
assertThat(underTest.getExceptionClass())
.as("The exception class should match with the known error code in the test")
.isEqualTo(knownExceptionClass);
assertThat(underTest.getMessage()).as("The message should match with the known error code in the test")
.isEqualTo(knownMessage);
assertThat(underTest.getParameters()).as("The parameters should match with the known error code in the test")
.isEqualTo(knownParameters);
}
}