use of org.folio.rest.jaxrs.model.RequestType in project mod-circulation-storage by folio-org.
the class RequestPoliciesApiTest method cannotUpdateRequestPolicyToExistingPolicyName.
@Test
public void cannotUpdateRequestPolicyToExistingPolicyName() throws InterruptedException, MalformedURLException, TimeoutException, ExecutionException {
CompletableFuture<JsonResponse> updateCompleted = new CompletableFuture<>();
String policy1Name = "Policy 1";
String policy2Name = "Policy 2";
List<RequestType> requestTypes = Arrays.asList(RequestType.HOLD, RequestType.PAGE);
createDefaultRequestPolicy(UUID.randomUUID(), policy1Name, "plain description", requestTypes);
RequestPolicy requestPolicy2 = createDefaultRequestPolicy(UUID.randomUUID(), policy2Name, "plain description", requestTypes);
// update: set the name of requestPolicy2 to be of policy1's.
requestPolicy2.setDescription("new description for policy 2");
requestPolicy2.setName(policy1Name);
requestPolicy2.setRequestTypes(Arrays.asList(RequestType.RECALL, RequestType.HOLD));
client.put(requestPolicyStorageUrl("/" + requestPolicy2.getId()), requestPolicy2, StorageTestSuite.TENANT_ID, ResponseHandler.json(updateCompleted));
JsonResponse response = updateCompleted.get(CONNECTION_TIMEOUT, TimeUnit.SECONDS);
assertThat("Failed to update request-policy", response, isBadRequest());
assertThat("Error message does not contain keyword 'already existed'", response.getBody(), containsString("already exists"));
}
Aggregations