Search in sources :

Example 1 with ResourceBulkFetchCollection

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

the class EholdingsResourcesImplTest method shouldReturnErrorWhenRMApiFails.

@Test
public void shouldReturnErrorWhenRMApiFails() throws IOException, URISyntaxException {
    mockGet(new RegexPattern(MANAGED_PACKAGE_ENDPOINT + "/titles.*"), SC_INTERNAL_SERVER_ERROR);
    String postBody = readFile("requests/kb-ebsco/resource/post-resources-bulk.json");
    final ResourceBulkFetchCollection bulkFetchCollection = postWithOk(RESOURCES_BULK_FETCH, postBody, STUB_TOKEN_HEADER).as(ResourceBulkFetchCollection.class);
    assertThat(bulkFetchCollection.getIncluded().size(), equalTo(0));
    assertThat(bulkFetchCollection.getMeta().getFailed().getResources().size(), equalTo(1));
    assertThat(bulkFetchCollection.getMeta().getFailed().getResources().get(0), equalTo("19-3964-762169"));
}
Also used : ResourceBulkFetchCollection(org.folio.rest.jaxrs.model.ResourceBulkFetchCollection) RegexPattern(com.github.tomakehurst.wiremock.matching.RegexPattern) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Aggregations

RegexPattern (com.github.tomakehurst.wiremock.matching.RegexPattern)1 ResourceBulkFetchCollection (org.folio.rest.jaxrs.model.ResourceBulkFetchCollection)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Test (org.junit.Test)1