Skip to content

Commit

Permalink
MODINVSTOR-1262 improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-barannyk committed Nov 11, 2024
1 parent 87b9b1c commit dd0f4ef
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,33 @@ void shouldReturnFalseIfServicePointIsNull() {

@Test
void shouldReturnFalseIfServicePointsAreIdentical() {
Servicepoint servicepoint = new Servicepoint();
var servicepoint = new Servicepoint();
var updateEventProcessor = new ServicePointSynchronizationUpdateEventProcessor(
updateEvent(servicepoint, servicepoint, TENANT));

assertFalse(updateEventProcessor.validateEventEntity());
}

@Test
void shouldReturnTrueIfNewServicePointIsValid() {
Servicepoint oldServicepoint = new Servicepoint().withId(UUID.randomUUID().toString());
Servicepoint newServicepoint = new Servicepoint().withId(UUID.randomUUID().toString());
void shouldReturnTrueForUpdateIfNewServicePointIsValid() {
var oldServicepoint = new Servicepoint().withId(UUID.randomUUID().toString());
var newServicepoint = new Servicepoint().withId(UUID.randomUUID().toString());

var updateEventProcessor = new ServicePointSynchronizationUpdateEventProcessor(
updateEvent(oldServicepoint, newServicepoint, TENANT));

assertTrue(updateEventProcessor.validateEventEntity());
}

@Test
void shouldReturnTrueForCreateIfNewServicePointIsValid() {
var servicepoint = new Servicepoint().withId(UUID.randomUUID().toString());
var createEventProcessor = new ServicePointSynchronizationCreateEventProcessor(
createEvent(servicepoint, TENANT));

assertTrue(createEventProcessor.validateEventEntity());
}

@Test
void shouldReturnFalseIfValidationMessageIsNotNull() {
Servicepoint oldServicepoint = new Servicepoint();
Expand All @@ -79,8 +88,11 @@ void shouldReturnFalseIfValidationMessageIsNotNull() {

var updateEventProcessor = new ServicePointSynchronizationUpdateEventProcessor(
updateEvent(oldServicepoint, newServicepoint, TENANT));
var createEventProcessor = new ServicePointSynchronizationCreateEventProcessor(
createEvent(newServicepoint, TENANT));

assertFalse(updateEventProcessor.validateEventEntity());
assertFalse(createEventProcessor.validateEventEntity());
}

private void processEventToThrowException(ServicePointSynchronizationEventProcessor processor,
Expand Down

0 comments on commit dd0f4ef

Please sign in to comment.