use of org.folio.rest.api.entities.PrecedingSucceedingTitle in project mod-inventory-storage by folio-org.
the class PrecedingSucceedingTitleTest method canCreateConnectedPrecedingSucceedingTitle.
@Test
public void canCreateConnectedPrecedingSucceedingTitle() {
IndividualResource instance1Resource = createInstance("Title One");
IndividualResource instance2Resource = createInstance("Title Two");
String instance1Id = instance1Resource.getId().toString();
String instance2Id = instance2Resource.getId().toString();
PrecedingSucceedingTitle precedingSucceedingTitle = new PrecedingSucceedingTitle(instance1Id, instance2Id, null, null, null);
IndividualResource response = precedingSucceedingTitleClient.create(precedingSucceedingTitle.getJson());
assertPrecedingSucceedingTitle(response, instance1Id, instance2Id, null, null, new JsonArray());
}
use of org.folio.rest.api.entities.PrecedingSucceedingTitle in project mod-inventory-storage by folio-org.
the class PrecedingSucceedingTitleTest method cannotCreatePrecedingSucceedingTitleWithEmptyPrecedingAndSucceedingInstanceId.
@Test
public void cannotCreatePrecedingSucceedingTitleWithEmptyPrecedingAndSucceedingInstanceId() {
JsonArray identifiers = new JsonArray();
identifiers.add(identifier(UUID_ISBN, "9781473619777"));
PrecedingSucceedingTitle precedingSucceedingTitle = new PrecedingSucceedingTitle(null, null, TITLE, HRID, identifiers);
Response response = precedingSucceedingTitleClient.attemptToCreate(precedingSucceedingTitle.getJson());
assertThat(response.getStatusCode(), is(HttpResponseStatus.UNPROCESSABLE_ENTITY.code()));
assertErrors(response, "The precedingInstanceId and succeedingInstanceId can't be empty at the same time");
}
use of org.folio.rest.api.entities.PrecedingSucceedingTitle in project mod-inventory-storage by folio-org.
the class PrecedingSucceedingTitleTest method canCreateUnconnectedSucceedingTitle.
@Test
public void canCreateUnconnectedSucceedingTitle() {
IndividualResource instanceResource = createInstance("Title One");
String instanceId = instanceResource.getId().toString();
JsonArray identifiers = new JsonArray();
identifiers.add(identifier(UUID_ISBN, "9781473619777"));
PrecedingSucceedingTitle precedingSucceedingTitle = new PrecedingSucceedingTitle(instanceId, null, TITLE, HRID, identifiers);
IndividualResource response = precedingSucceedingTitleClient.create(precedingSucceedingTitle.getJson());
assertPrecedingSucceedingTitle(response, instanceId, null, TITLE, HRID, identifiers);
}
use of org.folio.rest.api.entities.PrecedingSucceedingTitle in project mod-inventory-storage by folio-org.
the class PrecedingSucceedingTitleTest method cannotCreatePrecedingSucceedingTitleWithNonExistingPrecedingInstance.
@Test
public void cannotCreatePrecedingSucceedingTitleWithNonExistingPrecedingInstance() {
String nonExistingInstanceId = "14b65645-2e49-4a85-8dc1-43d444710570";
IndividualResource instanceResource = createInstance("Title One");
PrecedingSucceedingTitle precedingSucceedingTitle = new PrecedingSucceedingTitle(nonExistingInstanceId, instanceResource.getId().toString(), null, null, null);
Response response = precedingSucceedingTitleClient.attemptToCreate(precedingSucceedingTitle.getJson());
assertThat(response.getStatusCode(), is(HttpResponseStatus.UNPROCESSABLE_ENTITY.code()));
assertErrors(response, "Cannot set preceding_succeeding_title.precedinginstanceid = " + "14b65645-2e49-4a85-8dc1-43d444710570 because it does not exist in instance.id.");
}
use of org.folio.rest.api.entities.PrecedingSucceedingTitle in project mod-inventory-storage by folio-org.
the class PrecedingSucceedingTitleTest method canDeletePrecedingSucceedingTitle.
@Test
public void canDeletePrecedingSucceedingTitle() {
IndividualResource instanceResource = createInstance("Title One");
JsonArray identifiers = new JsonArray();
identifiers.add(identifier(UUID_ISBN, "9781473619777"));
PrecedingSucceedingTitle precedingSucceedingTitle = new PrecedingSucceedingTitle(null, instanceResource.getId().toString(), TITLE, HRID, identifiers);
IndividualResource response = precedingSucceedingTitleClient.create(precedingSucceedingTitle.getJson());
precedingSucceedingTitleClient.delete(response.getId());
Response getResponse = precedingSucceedingTitleClient.getById(response.getId());
assertThat(getResponse.getStatusCode(), is(HttpURLConnection.HTTP_NOT_FOUND));
}
Aggregations