From 4f2f1ecdfb5749211ab9aecb337321a5369cbc8f Mon Sep 17 00:00:00 2001 From: Roman_Barannyk Date: Fri, 12 Apr 2024 18:06:16 +0300 Subject: [PATCH] CIRC-2051 tests refactoring --- .../requests/AllowedServicePointsAPITests.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/test/java/api/requests/AllowedServicePointsAPITests.java b/src/test/java/api/requests/AllowedServicePointsAPITests.java index 9368e5e10c..bd09b92bbf 100644 --- a/src/test/java/api/requests/AllowedServicePointsAPITests.java +++ b/src/test/java/api/requests/AllowedServicePointsAPITests.java @@ -793,7 +793,15 @@ void shouldUseStubItemParameterInCirculationRuleMatchingWhenPresent() { } @Test - void shouldReturnEcsRequestRoutingServicePointsIfEcsRequestRoutingPresent() { + void shouldReturnErrorIfUseStubItemIsInvalid() { + Response errorResponse = getCreateOp(UUID.randomUUID().toString(), + UUID.randomUUID().toString(), null, "invalid", null, + HttpStatus.SC_BAD_REQUEST); + assertThat(errorResponse.getBody(), is("useStubItem is not a valid boolean: invalid.")); + } + + @Test + void shouldConsiderEcsRequestRoutingServicePointsParameterForAllowedServicePoints() { var requesterId = usersFixture.steve().getId().toString(); var instanceId = itemsFixture.createMultipleItemsForTheSameInstance(2).get(0) .getInstanceId().toString(); @@ -829,9 +837,12 @@ void shouldReturnEcsRequestRoutingServicePointsIfEcsRequestRoutingPresent() { assertServicePointsMatch(allowedServicePoints, List.of(cd1, cd2)); assertThat(response, hasNoJsonPath(HOLD.getValue())); assertThat(response, hasNoJsonPath(RECALL.getValue())); + } - Response errorResponse = getCreateOp(requesterId, instanceId, null, null, "invalid", - HttpStatus.SC_BAD_REQUEST); + @Test + void shouldReturnErrorIfEcsRequestRoutingIsInvalid() { + Response errorResponse = getCreateOp(UUID.randomUUID().toString(), + UUID.randomUUID().toString(), null, null, "invalid", HttpStatus.SC_BAD_REQUEST); assertThat(errorResponse.getBody(), is("ecsRequestRouting is not a valid boolean: invalid.")); }