use of org.folio.rest.support.Response in project mod-inventory-storage by folio-org.
the class LocationUnitTest method cannotCreateCampSameId.
@Test
public void cannotCreateCampSameId() throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
UUID instId = UUID.randomUUID();
createInst(instId, "Institute of MetaPhysics", "MPI");
UUID id = UUID.randomUUID();
createCamp(id, "Riverside Campus", "RS", instId);
Response response = createCamp(id, "Campus on the other Side of the River", "OS", instId);
assertThat(response.getStatusCode(), is(AdditionalHttpStatusCodes.UNPROCESSABLE_ENTITY));
}
use of org.folio.rest.support.Response in project mod-inventory-storage by folio-org.
the class LocationUnitTest method cannotCreateInstSameId.
@Test
public void cannotCreateInstSameId() throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
UUID id = UUID.randomUUID();
createInst(id, "Institute of MetaPhysics", "MPI");
Response response = createInst(id, "The Other Institute", "MPI");
assertThat(response.getStatusCode(), is(AdditionalHttpStatusCodes.UNPROCESSABLE_ENTITY));
}
use of org.folio.rest.support.Response in project mod-inventory-storage by folio-org.
the class LocationUnitTest method cannotCreateInstWithSameName.
@Test
public void cannotCreateInstWithSameName() throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
createInst("Institute of MetaPhysics", "MPI");
Response response = createInst("Institute of MetaPhysics", "MPI");
assertThat(response.getStatusCode(), is(AdditionalHttpStatusCodes.UNPROCESSABLE_ENTITY));
}
use of org.folio.rest.support.Response in project mod-inventory-storage by folio-org.
the class LocationUnitTest method canGetALibById.
@Test
public void canGetALibById() throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
UUID instId = UUID.randomUUID();
createInst(instId, "Institute of MetaPhysics", "MPI");
UUID campId = UUID.randomUUID();
createCamp(campId, "Riverside Campus", "RS", instId);
UUID id = UUID.randomUUID();
createLib(id, "Main Library", "ML", campId);
Response getResponse = getLibById(id);
assertThat(getResponse.getStatusCode(), is(HttpURLConnection.HTTP_OK));
JsonObject item = getResponse.getJson();
assertThat(item.getString("id"), is(id.toString()));
assertThat(item.getString("name"), is("Main Library"));
assertThat(item.getString("campusId"), is(campId.toString()));
}
use of org.folio.rest.support.Response in project mod-inventory-storage by folio-org.
the class LocationUnitTest method canCreateALib.
// //////////// Library tests
@Test
public void canCreateALib() throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
UUID instId = UUID.randomUUID();
createInst(instId, "Institute of MetaPhysics", "MPI");
UUID campId = UUID.randomUUID();
createCamp(campId, "Riverside Campus", "RS", instId);
Response response = createLib(null, "Main Library", "RS", campId);
assertThat(response.getStatusCode(), is(HttpURLConnection.HTTP_CREATED));
assertThat(response.getJson().getString("id"), notNullValue());
assertThat(response.getJson().getString("name"), is("Main Library"));
assertThat(response.getJson().getString("code"), is("RS"));
}
Aggregations