Search in sources :

Example 1 with PackagePostRequest

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

the class PackagePostValidatorTest method shouldThrowExceptionWhenPostDataAttributesNameIsEmpty.

@Test(expected = InputValidationException.class)
public void shouldThrowExceptionWhenPostDataAttributesNameIsEmpty() {
    PackagePostRequest postRequest = new PackagePostRequest().withData(new PackagePostData().withAttributes(new PackagePostDataAttributes().withName("")));
    validator.validate(postRequest);
}
Also used : PackagePostDataAttributes(org.folio.rest.jaxrs.model.PackagePostDataAttributes) PackagePostData(org.folio.rest.jaxrs.model.PackagePostData) PackagePostRequest(org.folio.rest.jaxrs.model.PackagePostRequest) Test(org.junit.Test)

Example 2 with PackagePostRequest

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

the class PackagePostValidatorTest method shouldThrowExceptionWhenPostDataAttributeCustomCoverageEndDateIsInvalidFormat.

@Test(expected = InputValidationException.class)
public void shouldThrowExceptionWhenPostDataAttributeCustomCoverageEndDateIsInvalidFormat() {
    PackagePostRequest postRequest = new PackagePostRequest().withData(new PackagePostData().withAttributes(new PackagePostDataAttributes().withName("name").withContentType(ContentType.STREAMING_MEDIA).withCustomCoverage(new Coverage().withBeginCoverage("2003-11-01").withEndCoverage("-01"))));
    validator.validate(postRequest);
}
Also used : PackagePostDataAttributes(org.folio.rest.jaxrs.model.PackagePostDataAttributes) Coverage(org.folio.rest.jaxrs.model.Coverage) PackagePostData(org.folio.rest.jaxrs.model.PackagePostData) PackagePostRequest(org.folio.rest.jaxrs.model.PackagePostRequest) Test(org.junit.Test)

Example 3 with PackagePostRequest

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

the class PackagePostValidatorTest method shouldThrowExceptionWhenPostDataAttributeCustomCoverageBeginDateIsInvalidFormat.

@Test(expected = InputValidationException.class)
public void shouldThrowExceptionWhenPostDataAttributeCustomCoverageBeginDateIsInvalidFormat() {
    PackagePostRequest postRequest = new PackagePostRequest().withData(new PackagePostData().withAttributes(new PackagePostDataAttributes().withName("name").withContentType(ContentType.STREAMING_MEDIA).withCustomCoverage(new Coverage().withBeginCoverage("-01"))));
    validator.validate(postRequest);
}
Also used : PackagePostDataAttributes(org.folio.rest.jaxrs.model.PackagePostDataAttributes) Coverage(org.folio.rest.jaxrs.model.Coverage) PackagePostData(org.folio.rest.jaxrs.model.PackagePostData) PackagePostRequest(org.folio.rest.jaxrs.model.PackagePostRequest) Test(org.junit.Test)

Example 4 with PackagePostRequest

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

the class PackagePostValidatorTest method shouldNotThrowExceptionWhenPostDataAttributeCustomCoverageWithValidBeginDateAndEndDateIsNull.

@Test
public void shouldNotThrowExceptionWhenPostDataAttributeCustomCoverageWithValidBeginDateAndEndDateIsNull() {
    PackagePostRequest postRequest = new PackagePostRequest().withData(new PackagePostData().withAttributes(new PackagePostDataAttributes().withName("name").withContentType(ContentType.STREAMING_MEDIA).withCustomCoverage(new Coverage().withBeginCoverage("2003-11-01").withEndCoverage(null))));
    validator.validate(postRequest);
}
Also used : PackagePostDataAttributes(org.folio.rest.jaxrs.model.PackagePostDataAttributes) Coverage(org.folio.rest.jaxrs.model.Coverage) PackagePostData(org.folio.rest.jaxrs.model.PackagePostData) PackagePostRequest(org.folio.rest.jaxrs.model.PackagePostRequest) Test(org.junit.Test)

Example 5 with PackagePostRequest

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

the class PackagePostValidatorTest method shouldThrowExceptionWhenNoPostBody.

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

Aggregations

PackagePostRequest (org.folio.rest.jaxrs.model.PackagePostRequest)21 Test (org.junit.Test)19 PackagePostData (org.folio.rest.jaxrs.model.PackagePostData)16 PackagePostDataAttributes (org.folio.rest.jaxrs.model.PackagePostDataAttributes)15 Coverage (org.folio.rest.jaxrs.model.Coverage)11 AnythingPattern (com.github.tomakehurst.wiremock.matching.AnythingPattern)1 EqualToPattern (com.github.tomakehurst.wiremock.matching.EqualToPattern)1 RegexPattern (com.github.tomakehurst.wiremock.matching.RegexPattern)1 AsyncResult (io.vertx.core.AsyncResult)1 Context (io.vertx.core.Context)1 Future (io.vertx.core.Future)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 UUID (java.util.UUID)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 CompletableFuture.completedFuture (java.util.concurrent.CompletableFuture.completedFuture)1 CompletionStage (java.util.concurrent.CompletionStage)1