use of org.folio.rest.support.JsonErrorResponse in project mod-inventory-storage by folio-org.
the class InstanceStorageTest method cannotProvideAdditionalPropertiesInInstanceIdentifiers.
@Test
public void cannotProvideAdditionalPropertiesInInstanceIdentifiers() throws InterruptedException, MalformedURLException, TimeoutException, ExecutionException {
JsonObject requestWithAdditionalProperty = nod(UUID.randomUUID());
requestWithAdditionalProperty.getJsonArray("identifiers").add(identifier(UUID_ISBN, "5645678432576").put("somethingAdditional", "foo"));
CompletableFuture<JsonErrorResponse> createCompleted = new CompletableFuture<>();
client.post(instancesStorageUrl(""), requestWithAdditionalProperty, TENANT_ID, ResponseHandler.jsonErrors(createCompleted));
JsonErrorResponse response = createCompleted.get(5, SECONDS);
assertThat(response.getStatusCode(), is(AdditionalHttpStatusCodes.UNPROCESSABLE_ENTITY));
assertThat(response.getErrors(), hasSoleMessageContaining("Unrecognized field"));
}
use of org.folio.rest.support.JsonErrorResponse in project mod-inventory-storage by folio-org.
the class InstanceStorageTest method cannotProvideAdditionalPropertiesInInstance.
@Test
public void cannotProvideAdditionalPropertiesInInstance() throws InterruptedException, MalformedURLException, TimeoutException, ExecutionException {
JsonObject requestWithAdditionalProperty = nod(UUID.randomUUID());
requestWithAdditionalProperty.put("somethingAdditional", "foo");
CompletableFuture<JsonErrorResponse> createCompleted = new CompletableFuture<>();
client.post(instancesStorageUrl(""), requestWithAdditionalProperty, TENANT_ID, ResponseHandler.jsonErrors(createCompleted));
JsonErrorResponse response = createCompleted.get(5, SECONDS);
assertThat(response.getStatusCode(), is(AdditionalHttpStatusCodes.UNPROCESSABLE_ENTITY));
assertThat(response.getErrors(), hasSoleMessageContaining("Unrecognized field"));
}
Aggregations