in src/it/java/com/epam/digital/data/platform/excerpt/api/controller/ExcerptControllerIT.java [132:157]
void shouldFindExcerptRecordInDatabase() throws Exception {
// given
String resultExcerpt = "Result excerpt";
when(excerptCephService.get("bucket", "11111111-1111-1111-1111-111111111111"))
.thenReturn(Optional.ofNullable(cephObject));
when(cephObject.getMetadata()).thenReturn(cephObjectMetadata);
when(cephObject.getContent()).thenReturn(new ByteArrayInputStream(resultExcerpt.getBytes()));
when(cephObjectMetadata.getContentLength()).thenReturn(14L);
ExcerptRecord excerptRecord = new ExcerptRecord();
excerptRecord.setKeycloakId(jwtHelper.getKeycloakId(OFFICER_TOKEN));
excerptRecord.setExcerptKey("11111111-1111-1111-1111-111111111111");
excerptRecord = saveExcerptRecordToDatabase(excerptRecord);
// when
var mvcResult = mockMvc.perform(get("/excerpts/" + excerptRecord.getId())
.header(ACCESS_TOKEN.getHeaderName(), OFFICER_TOKEN))
.andExpect(status().is2xxSuccessful())
.andReturn();
// then
assertThat(mvcResult.getResponse().getContentAsString()).isEqualTo(resultExcerpt);
}