diff --git a/src/test/java/org/folio/services/consortium/processor/ServicePointSynchronizationEventProcessorTest.java b/src/test/java/org/folio/services/consortium/processor/ServicePointSynchronizationEventProcessorTest.java index 4282da715..f89b5570b 100644 --- a/src/test/java/org/folio/services/consortium/processor/ServicePointSynchronizationEventProcessorTest.java +++ b/src/test/java/org/folio/services/consortium/processor/ServicePointSynchronizationEventProcessorTest.java @@ -9,10 +9,14 @@ import io.vertx.junit5.VertxExtension; import io.vertx.junit5.VertxTestContext; import java.util.UUID; +import java.util.stream.Stream; import org.folio.rest.jaxrs.model.HoldShelfExpiryPeriod; import org.folio.rest.jaxrs.model.Servicepoint; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; @ExtendWith(VertxExtension.class) public class ServicePointSynchronizationEventProcessorTest { @@ -32,14 +36,23 @@ void shouldFailToCreateEventDueToProcessEventException(VertxTestContext testCont processEventToThrowException(createEventProcessor, testContext); } - @Test - void shouldReturnFalseIfBothServicePointsAreNull() { + @ParameterizedTest + @MethodSource("servicePointProvider") + void shouldReturnFalseIfServicePointsAreNull(Servicepoint oldServicepoint, Servicepoint newServicepoint) { + String tenant = "tenant"; var updateEventProcessor = new ServicePointSynchronizationUpdateEventProcessor( - updateEvent(null, null, TENANT)); + updateEvent(oldServicepoint, newServicepoint, tenant)); assertFalse(updateEventProcessor.validateEventEntity()); } + static Stream servicePointProvider() { + return Stream.of( + Arguments.of(null, null), + Arguments.of(null, new Servicepoint()), + Arguments.of(new Servicepoint(), null)); + } + @Test void shouldReturnFalseIfServicePointIsNull() { var createEventProcessor = new ServicePointSynchronizationCreateEventProcessor( @@ -72,7 +85,7 @@ void shouldReturnTrueForUpdateIfNewServicePointIsValid() { } @Test - void shouldReturnTrueForCreateAndDeleteIfNewServicePointIsValid() { + void shouldReturnTrueForCreateAndDeleteIfServicePointIsValid() { var servicepoint = new Servicepoint().withId(UUID.randomUUID().toString()); var createEventProcessor = new ServicePointSynchronizationCreateEventProcessor( createEvent(servicepoint, TENANT));