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

Enchantments - Increase test coverage #619

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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