use of org.folio.rest.jaxrs.model.TitleCollectionItem in project mod-kb-ebsco-java by folio-org.
the class EholdingsTitlesTest method shouldReturnEmptyTitlesOnSearchByAccessTypesThatIsNotExist.
@Test
public void shouldReturnEmptyTitlesOnSearchByAccessTypesThatIsNotExist() throws IOException, URISyntaxException {
List<AccessType> accessTypes = insertAccessTypes(testData(configuration.getId()), vertx);
insertAccessTypeMapping(STUB_MANAGED_RESOURCE_ID, RESOURCE, accessTypes.get(0).getId(), vertx);
insertAccessTypeMapping(STUB_MANAGED_RESOURCE_ID_2, RESOURCE, accessTypes.get(1).getId(), vertx);
mockGetTitles();
String resourcePath = EHOLDINGS_TITLES_PATH + "?filter[access-type]=Not Exist";
TitleCollection titleCollection = getWithOk(resourcePath, STUB_TOKEN_HEADER).as(TitleCollection.class);
List<TitleCollectionItem> titles = titleCollection.getData();
assertThat(titles, hasSize(0));
assertEquals(0, (int) titleCollection.getMeta().getTotalResults());
}
use of org.folio.rest.jaxrs.model.TitleCollectionItem in project mod-kb-ebsco-java by folio-org.
the class EholdingsTitlesTest method shouldReturnTitlesOnSearchByAccessTypes.
@Test
public void shouldReturnTitlesOnSearchByAccessTypes() throws IOException, URISyntaxException {
List<AccessType> accessTypes = insertAccessTypes(testData(configuration.getId()), vertx);
insertAccessTypeMapping(STUB_MANAGED_RESOURCE_ID, RESOURCE, accessTypes.get(0).getId(), vertx);
insertAccessTypeMapping(STUB_MANAGED_RESOURCE_ID_2, RESOURCE, accessTypes.get(0).getId(), vertx);
mockGetTitles();
String resourcePath = EHOLDINGS_TITLES_PATH + "?filter[access-type]=" + STUB_ACCESS_TYPE_NAME;
TitleCollection titleCollection = getWithOk(resourcePath, STUB_TOKEN_HEADER).as(TitleCollection.class);
List<TitleCollectionItem> titles = titleCollection.getData();
assertThat(titles, hasSize(2));
assertEquals(2, (int) titleCollection.getMeta().getTotalResults());
assertThat(titles, everyItem(hasProperty("id", anyOf(equalTo(STUB_MANAGED_TITLE_ID), equalTo(STUB_MANAGED_TITLE_ID_2)))));
}
use of org.folio.rest.jaxrs.model.TitleCollectionItem in project mod-kb-ebsco-java by folio-org.
the class EholdingsTitlesTest method shouldReturnTitleOnSearchByAccessTypesWithPagination.
@Test
public void shouldReturnTitleOnSearchByAccessTypesWithPagination() throws IOException, URISyntaxException {
List<AccessType> accessTypes = insertAccessTypes(testData(configuration.getId()), vertx);
insertAccessTypeMapping(STUB_MANAGED_RESOURCE_ID, RESOURCE, accessTypes.get(0).getId(), vertx);
insertAccessTypeMapping(STUB_MANAGED_RESOURCE_ID_2, RESOURCE, accessTypes.get(1).getId(), vertx);
mockGetTitles();
String resourcePath = EHOLDINGS_TITLES_PATH + "?page=2&count=1&filter[access-type]=" + STUB_ACCESS_TYPE_NAME + "&filter[access-type]=" + STUB_ACCESS_TYPE_NAME_2;
TitleCollection titleCollection = getWithOk(resourcePath, STUB_TOKEN_HEADER).as(TitleCollection.class);
List<TitleCollectionItem> titles = titleCollection.getData();
assertThat(titles, hasSize(1));
assertEquals(2, (int) titleCollection.getMeta().getTotalResults());
assertThat(titles, everyItem(hasProperty("id", equalTo(STUB_MANAGED_TITLE_ID))));
}
use of org.folio.rest.jaxrs.model.TitleCollectionItem in project mod-kb-ebsco-java by folio-org.
the class EholdingsTitlesTest method shouldReturnTitlesWithResourcesOnSearchByAccessTypes.
@Test
public void shouldReturnTitlesWithResourcesOnSearchByAccessTypes() throws IOException, URISyntaxException {
List<AccessType> accessTypes = insertAccessTypes(testData(configuration.getId()), vertx);
insertAccessTypeMapping(STUB_MANAGED_RESOURCE_ID, RESOURCE, accessTypes.get(0).getId(), vertx);
insertAccessTypeMapping(STUB_MANAGED_RESOURCE_ID_2, RESOURCE, accessTypes.get(0).getId(), vertx);
mockGetTitles();
String resourcePath = EHOLDINGS_TITLES_PATH + "?filter[access-type]=" + STUB_ACCESS_TYPE_NAME + "&include=resources";
TitleCollection titleCollection = getWithOk(resourcePath, STUB_TOKEN_HEADER).as(TitleCollection.class);
List<TitleCollectionItem> titles = titleCollection.getData();
assertThat(titles, hasSize(2));
assertEquals(2, (int) titleCollection.getMeta().getTotalResults());
assertThat(titles, everyItem(hasProperty("id", anyOf(equalTo(STUB_MANAGED_TITLE_ID), equalTo(STUB_MANAGED_TITLE_ID_2)))));
assertThat(titles, everyItem(hasProperty("included", not(empty()))));
}
Aggregations