use of org.folio.repository.titles.DbTitle in project mod-kb-ebsco-java by folio-org.
the class EholdingsTitlesTest method shouldUpdateTitleDataOnSecondPut.
@Test
public void shouldUpdateTitleDataOnSecondPut() throws IOException, URISyntaxException {
String newName = "new name";
String updatedResponse = "responses/rmapi/resources/get-custom-resource-updated-title-name-response.json";
putTitle(readFile(updatedResponse), Collections.singletonList(STUB_TAG_VALUE));
ObjectMapper mapper = new ObjectMapper();
TitlePutRequest request = mapper.readValue(readFile("requests/kb-ebsco/title/put-title.json"), TitlePutRequest.class);
request.getData().getAttributes().withName(newName);
stubFor(get(new UrlPathPattern(new RegexPattern(CUSTOM_TITLE_ENDPOINT), false)).willReturn(new ResponseDefinitionBuilder().withBody(readFile(updatedResponse))));
putWithOk(EHOLDINGS_TITLES_PATH + "/" + STUB_CUSTOM_TITLE_ID, mapper.writeValueAsString(request), STUB_TOKEN_HEADER);
List<DbTitle> titles = TitlesTestUtil.getTitles(vertx);
assertEquals(1, titles.size());
assertEqualsLong(titles.get(0).getId());
assertEquals(newName, titles.get(0).getName());
}
Aggregations