use of org.folio.rest.jaxrs.model.Title in project mod-kb-ebsco-java by folio-org.
the class TitleConverter method includeTagsIfNeeded.
private void includeTagsIfNeeded(Title title, TitleResult titleResult) {
if (nonNull(titleResult.getResourceTagList())) {
for (ResourceCollectionItem resourceCollectionItem : title.getIncluded()) {
List<DbTag> tags = titleResult.getResourceTagList().stream().filter(tag -> resourceCollectionItem.getId().equals(tag.getRecordId())).collect(Collectors.toList());
resourceCollectionItem.getAttributes().withTags(tagsConverter.convert(tags));
}
}
}
use of org.folio.rest.jaxrs.model.Title in project mod-kb-ebsco-java by folio-org.
the class EholdingsTitlesTest method shouldReturnTitleTagsWhenValidId.
@Test
public void shouldReturnTitleTagsWhenValidId() throws IOException, URISyntaxException {
String stubResponseFile = "responses/rmapi/titles/get-title-by-id-response.json";
saveTag(vertx, STUB_MANAGED_TITLE_ID, RecordType.TITLE, STUB_TAG_VALUE);
stubFor(get(new UrlPathPattern(new RegexPattern("/rm/rmaccounts/" + STUB_CUSTOMER_ID + "/titles.*"), true)).willReturn(new ResponseDefinitionBuilder().withBody(readFile(stubResponseFile))));
Title actualResponse = getWithOk(EHOLDINGS_TITLES_PATH + "/" + STUB_TITLE_ID, STUB_TOKEN_HEADER).as(Title.class);
assertTrue(actualResponse.getData().getAttributes().getTags().getTagList().contains(STUB_TAG_VALUE));
}
Aggregations