use of org.folio.rest.jaxrs.model.PackageTagsPutRequest in project mod-kb-ebsco-java by folio-org.
the class PackageTagsPutBodyValidatorTest method shouldThrowExceptionWhenNameIsEmpty.
@Test(expected = InputValidationException.class)
public void shouldThrowExceptionWhenNameIsEmpty() {
PackageTagsPutRequest request = new PackageTagsPutRequest().withData(new PackageTagsPutData().withAttributes(new PackageTagsDataAttributes().withName("").withContentType(ContentType.E_BOOK)));
validator.validate(request);
}
use of org.folio.rest.jaxrs.model.PackageTagsPutRequest in project mod-kb-ebsco-java by folio-org.
the class PackageTagsPutBodyValidatorTest method shouldThrowExceptionWhenContentTypeIsNull.
@Test(expected = InputValidationException.class)
public void shouldThrowExceptionWhenContentTypeIsNull() {
PackageTagsPutRequest request = new PackageTagsPutRequest().withData(new PackageTagsPutData().withAttributes(new PackageTagsDataAttributes().withName("name")));
validator.validate(request);
}
use of org.folio.rest.jaxrs.model.PackageTagsPutRequest in project mod-kb-ebsco-java by folio-org.
the class EholdingsProvidersImplTest method shouldReturn422OnPutTagsWhenRequestBodyIsInvalid.
@Test
public void shouldReturn422OnPutTagsWhenRequestBodyIsInvalid() throws IOException, URISyntaxException {
ObjectMapper mapper = new ObjectMapper();
PackageTagsPutRequest tags = mapper.readValue(getFile(PUT_PROVIDER_TAGS), PackageTagsPutRequest.class);
tags.getData().getAttributes().setName("");
JsonapiError error = putWithStatus(PROVIDER_TAGS_PATH, mapper.writeValueAsString(tags), SC_UNPROCESSABLE_ENTITY, STUB_TOKEN_HEADER).as(JsonapiError.class);
assertErrorContainsTitle(error, "Invalid name");
assertErrorContainsDetail(error, "name must not be empty");
}
use of org.folio.rest.jaxrs.model.PackageTagsPutRequest in project mod-kb-ebsco-java by folio-org.
the class EholdingsPackagesTest method sendPutTags.
private void sendPutTags(List<String> newTags) throws IOException, URISyntaxException {
PackageTagsPutRequest tags = mapper.readValue(getFile("requests/kb-ebsco/package/put-package-tags.json"), PackageTagsPutRequest.class);
if (newTags != null) {
tags.getData().getAttributes().setTags(new Tags().withTagList(newTags));
}
putWithOk(PACKAGE_TAGS_PATH, mapper.writeValueAsString(tags), STUB_TOKEN_HEADER).as(PackageTags.class);
}
use of org.folio.rest.jaxrs.model.PackageTagsPutRequest in project mod-kb-ebsco-java by folio-org.
the class EholdingsPackagesTest method shouldReturn422OnPutTagsWhenRequestBodyIsInvalid.
@Test
public void shouldReturn422OnPutTagsWhenRequestBodyIsInvalid() throws IOException, URISyntaxException {
PackageTagsPutRequest tags = mapper.readValue(getFile("requests/kb-ebsco/package/put-package-tags.json"), PackageTagsPutRequest.class);
tags.getData().getAttributes().setName("");
JsonapiError error = putWithStatus(PACKAGE_TAGS_PATH, mapper.writeValueAsString(tags), SC_UNPROCESSABLE_ENTITY, STUB_TOKEN_HEADER).as(JsonapiError.class);
assertErrorContainsTitle(error, "Invalid name");
}
Aggregations