use of org.folio.rest.jaxrs.model.PackageTagsDataAttributes in project mod-kb-ebsco-java by folio-org.
the class PackageTagsPutBodyValidator method validate.
public void validate(PackageTagsPutRequest request) {
if (request == null || request.getData() == null || request.getData().getAttributes() == null) {
throw new InputValidationException(INVALID_REQUEST_BODY_TITLE, INVALID_REQUEST_BODY_DETAILS);
}
PackageTagsDataAttributes attributes = request.getData().getAttributes();
ValidatorUtil.checkIsNotBlank("name", attributes.getName());
ValidatorUtil.checkMaxLength("name", attributes.getName(), 200);
ValidatorUtil.checkIsNotNull("contentType", attributes.getContentType());
ValidatorUtil.checkIsNotNull("tags", attributes.getTags());
}
use of org.folio.rest.jaxrs.model.PackageTagsDataAttributes 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.PackageTagsDataAttributes 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);
}
Aggregations