Search in sources :

Example 1 with PackageTagsDataAttributes

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());
}
Also used : InputValidationException(org.folio.rest.exception.InputValidationException) PackageTagsDataAttributes(org.folio.rest.jaxrs.model.PackageTagsDataAttributes)

Example 2 with PackageTagsDataAttributes

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);
}
Also used : PackageTagsPutRequest(org.folio.rest.jaxrs.model.PackageTagsPutRequest) PackageTagsPutData(org.folio.rest.jaxrs.model.PackageTagsPutData) PackageTagsDataAttributes(org.folio.rest.jaxrs.model.PackageTagsDataAttributes) Test(org.junit.Test)

Example 3 with PackageTagsDataAttributes

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);
}
Also used : PackageTagsPutRequest(org.folio.rest.jaxrs.model.PackageTagsPutRequest) PackageTagsPutData(org.folio.rest.jaxrs.model.PackageTagsPutData) PackageTagsDataAttributes(org.folio.rest.jaxrs.model.PackageTagsDataAttributes) Test(org.junit.Test)

Aggregations

PackageTagsDataAttributes (org.folio.rest.jaxrs.model.PackageTagsDataAttributes)3 PackageTagsPutData (org.folio.rest.jaxrs.model.PackageTagsPutData)2 PackageTagsPutRequest (org.folio.rest.jaxrs.model.PackageTagsPutRequest)2 Test (org.junit.Test)2 InputValidationException (org.folio.rest.exception.InputValidationException)1