Skip to content

Commit

Permalink
MODINVSTOR-1262 add test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-barannyk committed Nov 11, 2024
1 parent 1f8da1b commit e8822af
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<Arguments> 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(
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit e8822af

Please sign in to comment.