Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Test for VerificationServiceHealthIndicator, remove null check (#619)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoduessmann authored Jun 24, 2020
1 parent 0c1794e commit 61dbbda
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ public boolean isValid(SubmissionPayload submissionPayload, ConstraintValidatorC
List<TemporaryExposureKey> exposureKeys = submissionPayload.getKeysList();
validatorContext.disableDefaultConstraintViolation();

if (Objects.isNull(exposureKeys)) {
addViolation(validatorContext, "Field 'keys' points to Null.");
return false;
}

boolean isValid = checkKeyCollectionSize(exposureKeys, validatorContext);
isValid &= checkUniqueStartIntervalNumbers(exposureKeys, validatorContext);
isValid &= checkNoOverlapsInTimeWindow(exposureKeys, validatorContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,19 @@ public void setup() {
}

@Test
void checkIsHealthyIfVerificationServerIsRunning() throws Exception {
void checkIsHealthyIfVerificationServerIsRunningAndExceptionIsThrown() throws Exception {
when(verificationServerClient.verifyTan(any())).thenThrow(FeignException.NotFound.class);
mvc.perform(get("/actuator/health"))
.andExpect(status().is2xxSuccessful()).andReturn();
}

@Test
void checkIsHealthyIfVerificationServerIsRunning() throws Exception {
when(verificationServerClient.verifyTan(any())).thenReturn("ok");
mvc.perform(get("/actuator/health"))
.andExpect(status().is2xxSuccessful()).andReturn();
}

@Test
void checkIsUnhealthyIfVerificationServerIsDown() throws Exception {
when(verificationServerClient.verifyTan(any())).thenThrow(FeignException.InternalServerError.class);
Expand Down

0 comments on commit 61dbbda

Please sign in to comment.