Search in sources :

Example 11 with TitlePostRequest

use of org.folio.rest.jaxrs.model.TitlePostRequest 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 12 with TitlePostRequest

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

the class TitlePostBodyValidatorTest method shouldThrowExceptionWhenNoPostData.

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

Example 13 with TitlePostRequest

use of org.folio.rest.jaxrs.model.TitlePostRequest 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 14 with TitlePostRequest

use of org.folio.rest.jaxrs.model.TitlePostRequest 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)

Example 15 with TitlePostRequest

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

the class TitlePostBodyValidatorTest method shouldNotThrowExceptionIfTitlePublisherNameIsNull.

@Test
public void shouldNotThrowExceptionIfTitlePublisherNameIsNull() {
    TitlePostRequest titlePostRequest = createRequest(new TitlePostDataAttributes().withName(TITLE_TEST_NAME).withPublicationType(PublicationType.BOOK).withPublisherName(null));
    validator.validate(titlePostRequest);
}
Also used : TitlePostRequest(org.folio.rest.jaxrs.model.TitlePostRequest) TitlePostDataAttributes(org.folio.rest.jaxrs.model.TitlePostDataAttributes) Test(org.junit.Test)

Aggregations

TitlePostRequest (org.folio.rest.jaxrs.model.TitlePostRequest)21 Test (org.junit.Test)18 TitlePostDataAttributes (org.folio.rest.jaxrs.model.TitlePostDataAttributes)14 TitlePostData (org.folio.rest.jaxrs.model.TitlePostData)8 Tags (org.folio.rest.jaxrs.model.Tags)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ResponseDefinitionBuilder (com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder)1 EqualToJsonPattern (com.github.tomakehurst.wiremock.matching.EqualToJsonPattern)1 EqualToPattern (com.github.tomakehurst.wiremock.matching.EqualToPattern)1 RegexPattern (com.github.tomakehurst.wiremock.matching.RegexPattern)1 UrlPathPattern (com.github.tomakehurst.wiremock.matching.UrlPathPattern)1 AsyncResult (io.vertx.core.AsyncResult)1 Context (io.vertx.core.Context)1 Handler (io.vertx.core.Handler)1 Vertx (io.vertx.core.Vertx)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 UUID (java.util.UUID)1