Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K1J-146: Updated logic in IntegratedUnitNotificationEvaluator so that it complies with business logic. #1110

Merged
merged 1 commit into from
Sep 10, 2024
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 @@ -74,6 +74,6 @@ private boolean evaluateMailNotification(List<String> unitIds, List<String> care
return false;
}

return activateFrom.isBefore(issuingDate);
return issuingDate.isBefore(activateFrom);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void shallReturnFalseIfNotificationConfigDoesNotContainAnyMatchingUnitOrCareUnit
}

@Test
void shallReturnFalseIfDateInConfigurationIsAfterActivationDate() {
void shallReturnTrueIfDateOfIssuingUnitIsBeforeConfigurationDateTime() {
final var regionNotificationConfig = RegionNotificationConfig.builder()
.region(REGION)
.configuration(
Expand All @@ -91,11 +91,11 @@ void shallReturnFalseIfDateInConfigurationIsAfterActivationDate() {
doReturn(List.of(regionNotificationConfig)).when(getUnitNotificationConfig).get();
final var result = integratedUnitNotificationEvaluator.mailNotification(CARE_PROVIDER_ID, ISSUED_ON_UNIT_ID, CERTIFICATE_ID,
ISSUING_DATE);
assertFalse(result);
assertTrue(result);
}

@Test
void shallReturnTrueIfDateInConfigurationIsBeforeActivationDateAndCareProviderMatch() {
void shallReturnFalseIfDateOfIssuingUnitIsBeforeConfigurationDateTimeButDoesNotMatchAnyUnitId() {
final var regionNotificationConfig = RegionNotificationConfig.builder()
.region(REGION)
.configuration(
Expand All @@ -111,27 +111,7 @@ void shallReturnTrueIfDateInConfigurationIsBeforeActivationDateAndCareProviderMa
doReturn(List.of(regionNotificationConfig)).when(getUnitNotificationConfig).get();
final var result = integratedUnitNotificationEvaluator.mailNotification(CARE_PROVIDER_ID, ISSUED_ON_UNIT_ID, CERTIFICATE_ID,
ISSUING_DATE);
assertTrue(result);
}

@Test
void shallReturnTrueIfDateInConfigurationIsBeforeActivationDateAndUnitIdMatch() {
final var regionNotificationConfig = RegionNotificationConfig.builder()
.region(REGION)
.configuration(
List.of(
IntegratedUnitNotificationConfig.builder()
.careProviders(List.of(NOT_MATCHING_ID))
.issuedOnUnit(List.of(ISSUED_ON_UNIT_ID))
.datetime(LocalDateTime.now().minusDays(1))
.build()
))
.build();

doReturn(List.of(regionNotificationConfig)).when(getUnitNotificationConfig).get();
final var result = integratedUnitNotificationEvaluator.mailNotification(CARE_PROVIDER_ID, ISSUED_ON_UNIT_ID, CERTIFICATE_ID,
ISSUING_DATE);
assertTrue(result);
assertFalse(result);
}

@Nested
Expand All @@ -145,7 +125,7 @@ void shallHandleMatchingValuesWithNullValuesForCareProviderIds() {
List.of(
IntegratedUnitNotificationConfig.builder()
.issuedOnUnit(List.of(ISSUED_ON_UNIT_ID))
.datetime(LocalDateTime.now().minusDays(1))
.datetime(LocalDateTime.now().plusDays(1))
.build()
))
.build();
Expand All @@ -157,14 +137,14 @@ void shallHandleMatchingValuesWithNullValuesForCareProviderIds() {
}

@Test
void shallHandleMatchingValuesWithNullValuesForUnitIds() {
void shallHandleMatchingValuesWithNullValuesForIssuedOnUnitId() {
final var regionNotificationConfig = RegionNotificationConfig.builder()
.region(REGION)
.configuration(
List.of(
IntegratedUnitNotificationConfig.builder()
.careProviders(List.of(NOT_MATCHING_ID))
.datetime(LocalDateTime.now().minusDays(1))
.careProviders(List.of(CARE_PROVIDER_ID))
.datetime(LocalDateTime.now().plusDays(1))
.build()
))
.build();
Expand All @@ -175,5 +155,4 @@ void shallHandleMatchingValuesWithNullValuesForUnitIds() {
assertTrue(result);
}
}

}
Loading