use of org.folio.rest.jaxrs.model.ProviderCollection in project mod-kb-ebsco-java by folio-org.
the class EholdingsProvidersImplTest method shouldReturnProvidersOnSearchByTagsOnly.
@Test
public void shouldReturnProvidersOnSearchByTagsOnly() {
saveTag(vertx, STUB_VENDOR_ID, PROVIDER, STUB_TAG_VALUE);
saveTag(vertx, STUB_VENDOR_ID_2, PROVIDER, STUB_TAG_VALUE);
saveTag(vertx, STUB_VENDOR_ID_2, PROVIDER, STUB_TAG_VALUE_2);
saveTag(vertx, STUB_VENDOR_ID_3, PROVIDER, STUB_TAG_VALUE_3);
setUpTaggedProviders();
ProviderCollection providerCollection = getWithOk(PROVIDER_PATH + "?filter[tags]=" + STUB_TAG_VALUE + "&filter[tags]=" + STUB_TAG_VALUE_2, STUB_TOKEN_HEADER).as(ProviderCollection.class);
List<Providers> providers = providerCollection.getData();
assertEquals(2, (int) providerCollection.getMeta().getTotalResults());
assertEquals(2, providers.size());
assertEquals(STUB_VENDOR_NAME, providers.get(0).getAttributes().getName());
assertEquals(STUB_VENDOR_NAME_2, providers.get(1).getAttributes().getName());
}
use of org.folio.rest.jaxrs.model.ProviderCollection in project mod-kb-ebsco-java by folio-org.
the class EholdingsProvidersImplTest method shouldReturnEmptyResponseWhenProvidersReturnedWithErrorOnSearchByTags.
@Test
public void shouldReturnEmptyResponseWhenProvidersReturnedWithErrorOnSearchByTags() {
String credentialsId = configuration.getId();
ProvidersTestUtil.saveProvider(buildDbProvider(STUB_VENDOR_ID, credentialsId, STUB_VENDOR_NAME), vertx);
ProvidersTestUtil.saveProvider(buildDbProvider(STUB_VENDOR_ID_2, credentialsId, STUB_VENDOR_NAME_2), vertx);
saveTag(vertx, STUB_VENDOR_ID, PROVIDER, STUB_TAG_VALUE);
saveTag(vertx, STUB_VENDOR_ID_2, PROVIDER, STUB_TAG_VALUE);
mockGet(new RegexPattern(".*vendors/.*"), SC_INTERNAL_SERVER_ERROR);
ProviderCollection providerCollection = getWithOk(PROVIDER_PATH + "?filter[tags]=" + STUB_TAG_VALUE, STUB_TOKEN_HEADER).as(ProviderCollection.class);
List<Providers> providers = providerCollection.getData();
assertEquals(2, (int) providerCollection.getMeta().getTotalResults());
assertEquals(0, providers.size());
}
use of org.folio.rest.jaxrs.model.ProviderCollection in project mod-kb-ebsco-java by folio-org.
the class EholdingsProvidersImplTest method shouldReturnProvidersOnSearchWithTagsAndPagination.
@Test
public void shouldReturnProvidersOnSearchWithTagsAndPagination() {
saveTag(vertx, STUB_VENDOR_ID, PROVIDER, STUB_TAG_VALUE);
saveTag(vertx, STUB_VENDOR_ID_2, PROVIDER, STUB_TAG_VALUE);
saveTag(vertx, STUB_VENDOR_ID_3, PROVIDER, STUB_TAG_VALUE);
setUpTaggedProviders();
ProviderCollection providerCollection = getWithOk(PROVIDER_PATH + "?page=2&count=1&filter[tags]=" + STUB_TAG_VALUE, STUB_TOKEN_HEADER).as(ProviderCollection.class);
List<Providers> providers = providerCollection.getData();
assertEquals(3, (int) providerCollection.getMeta().getTotalResults());
assertEquals(1, providers.size());
assertEquals(STUB_VENDOR_NAME_2, providers.get(0).getAttributes().getName());
}
Aggregations