Search in sources :

Example 1 with TitlePostData

use of org.folio.rest.jaxrs.model.TitlePostData in project mod-kb-ebsco-java by folio-org.

the class TitlePostBodyValidatorTest method shouldThrowExceptionIfTitleNameIsEmpty.

@Test(expected = InputValidationException.class)
public void shouldThrowExceptionIfTitleNameIsEmpty() {
    TitlePostRequest titlePostRequest = new TitlePostRequest();
    titlePostRequest.withData(new TitlePostData().withAttributes(new TitlePostDataAttributes().withName("")));
    validator.validate(titlePostRequest);
}
Also used : TitlePostRequest(org.folio.rest.jaxrs.model.TitlePostRequest) TitlePostData(org.folio.rest.jaxrs.model.TitlePostData) TitlePostDataAttributes(org.folio.rest.jaxrs.model.TitlePostDataAttributes) Test(org.junit.Test)

Example 2 with TitlePostData

use of org.folio.rest.jaxrs.model.TitlePostData in project mod-kb-ebsco-java by folio-org.

the class TitlePostBodyValidatorTest method createRequest.

private TitlePostRequest createRequest(TitlePostDataAttributes attributes) {
    TitlePostRequest titlePostRequest = new TitlePostRequest();
    titlePostRequest.withData(new TitlePostData().withAttributes(attributes)).withIncluded(getTitlePostIncluded());
    return titlePostRequest;
}
Also used : TitlePostRequest(org.folio.rest.jaxrs.model.TitlePostRequest) TitlePostData(org.folio.rest.jaxrs.model.TitlePostData)

Example 3 with TitlePostData

use of org.folio.rest.jaxrs.model.TitlePostData in project mod-kb-ebsco-java by folio-org.

the class TitlePostBodyValidatorTest method shouldThrowExceptionWhenEmptyPostData.

@Test(expected = InputValidationException.class)
public void shouldThrowExceptionWhenEmptyPostData() {
    TitlePostRequest postRequest = new TitlePostRequest().withData(new TitlePostData());
    validator.validate(postRequest);
}
Also used : TitlePostRequest(org.folio.rest.jaxrs.model.TitlePostRequest) TitlePostData(org.folio.rest.jaxrs.model.TitlePostData) Test(org.junit.Test)

Example 4 with TitlePostData

use of org.folio.rest.jaxrs.model.TitlePostData in project mod-kb-ebsco-java by folio-org.

the class TitlePostBodyValidatorTest method shouldThrowExceptionIfTitlePublisherNameIsTooLong.

@Test(expected = InputValidationException.class)
public void shouldThrowExceptionIfTitlePublisherNameIsTooLong() {
    TitlePostRequest titlePostRequest = new TitlePostRequest();
    titlePostRequest.withData(new TitlePostData().withAttributes(new TitlePostDataAttributes().withName(TITLE_TEST_NAME).withPublisherName(TEXT_LONGER_THAN_250_CHARACTERS)));
    validator.validate(titlePostRequest);
}
Also used : TitlePostRequest(org.folio.rest.jaxrs.model.TitlePostRequest) TitlePostData(org.folio.rest.jaxrs.model.TitlePostData) TitlePostDataAttributes(org.folio.rest.jaxrs.model.TitlePostDataAttributes) Test(org.junit.Test)

Example 5 with TitlePostData

use of org.folio.rest.jaxrs.model.TitlePostData in project mod-kb-ebsco-java by folio-org.

the class TitlePostBodyValidatorTest method shouldThrowExceptionIfTitleIdentifierIdTooLong.

@Test(expected = InputValidationException.class)
public void shouldThrowExceptionIfTitleIdentifierIdTooLong() {
    TitlePostRequest titlePostRequest = new TitlePostRequest();
    List<Identifier> titleIdentifiers = new ArrayList<>();
    titleIdentifiers.add(new Identifier().withId("1234567-1234567-1234567"));
    titlePostRequest.withData(new TitlePostData().withAttributes(new TitlePostDataAttributes().withName(TITLE_TEST_NAME).withPublisherName("Test publisher name").withIdentifiers(titleIdentifiers)));
    validator.validate(titlePostRequest);
}
Also used : TitlePostRequest(org.folio.rest.jaxrs.model.TitlePostRequest) Identifier(org.folio.rest.jaxrs.model.Identifier) ArrayList(java.util.ArrayList) TitlePostData(org.folio.rest.jaxrs.model.TitlePostData) TitlePostDataAttributes(org.folio.rest.jaxrs.model.TitlePostDataAttributes) Test(org.junit.Test)

Aggregations

TitlePostData (org.folio.rest.jaxrs.model.TitlePostData)8 TitlePostRequest (org.folio.rest.jaxrs.model.TitlePostRequest)8 Test (org.junit.Test)7 TitlePostDataAttributes (org.folio.rest.jaxrs.model.TitlePostDataAttributes)6 ArrayList (java.util.ArrayList)1 Identifier (org.folio.rest.jaxrs.model.Identifier)1