Search in sources :

Example 1 with Coverage

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

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

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

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

the class PackagePostValidatorTest method shouldThrowExceptionWhenPostDataAttributeCustomCoverageBeginDateIsNull.

@Test(expected = InputValidationException.class)
public void shouldThrowExceptionWhenPostDataAttributeCustomCoverageBeginDateIsNull() {
    PackagePostRequest postRequest = new PackagePostRequest().withData(new PackagePostData().withAttributes(new PackagePostDataAttributes().withName("name").withContentType(ContentType.STREAMING_MEDIA).withCustomCoverage(new Coverage())));
    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 Coverage

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

the class PackagePostValidatorTest method shouldNotThrowExceptionWhenPostDataAttributeCustomCoverageBeginDateIsEmpty.

@Test
public void shouldNotThrowExceptionWhenPostDataAttributeCustomCoverageBeginDateIsEmpty() {
    PackagePostRequest postRequest = new PackagePostRequest().withData(new PackagePostData().withAttributes(new PackagePostDataAttributes().withName("name").withContentType(ContentType.STREAMING_MEDIA).withCustomCoverage(new Coverage().withBeginCoverage(""))));
    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)

Aggregations

Coverage (org.folio.rest.jaxrs.model.Coverage)20 Test (org.junit.Test)15 PackagePostData (org.folio.rest.jaxrs.model.PackagePostData)11 PackagePostDataAttributes (org.folio.rest.jaxrs.model.PackagePostDataAttributes)11 PackagePostRequest (org.folio.rest.jaxrs.model.PackagePostRequest)11 PackagePut (org.folio.holdingsiq.model.PackagePut)3 PackagePutDataAttributes (org.folio.rest.jaxrs.model.PackagePutDataAttributes)3 InputValidationException (org.folio.rest.exception.InputValidationException)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 PackagePost (org.folio.holdingsiq.model.PackagePost)1 Title (org.folio.holdingsiq.model.Title)1 EmbargoUnit (org.folio.rest.jaxrs.model.EmbargoPeriod.EmbargoUnit)1 PackageBulkFetchCollectionItem (org.folio.rest.jaxrs.model.PackageBulkFetchCollectionItem)1 PackageBulkFetchDataAttributes (org.folio.rest.jaxrs.model.PackageBulkFetchDataAttributes)1 PackageCollectionItem (org.folio.rest.jaxrs.model.PackageCollectionItem)1 PackageDataAttributes (org.folio.rest.jaxrs.model.PackageDataAttributes)1 Resource (org.folio.rest.jaxrs.model.Resource)1 VisibilityData (org.folio.rest.jaxrs.model.VisibilityData)1 ResourceResult (org.folio.rmapi.result.ResourceResult)1