in component-test/src/main/java/org/apache/fineract/cn/rhythm/RhythmApiDocumentation.java [111:143]
public void documentGetBeat ( ) throws InterruptedException {
final String applicationIdentifier = "funnybusiness-v2";
final String oldBeatId = "oldBeatIdentifier789";
final LocalDateTime now = LocalDateTime.now(ZoneId.of("UTC"));
int alignmentHour = now.getHour();
final LocalDateTime expectedBeatTimestamp = getExpectedBeatTimestamp(now, alignmentHour);
Mockito.doAnswer(new Returns(true)).when(super.beatPublisherServiceMock).publishBeat(
Matchers.eq(oldBeatId),
Matchers.eq(tenantDataStoreContext.getTenantName()),
Matchers.eq(applicationIdentifier),
Matchers.eq(expectedBeatTimestamp));
final Beat createdBeat = createBeat(applicationIdentifier, oldBeatId, alignmentHour, expectedBeatTimestamp);
try {
this.mockMvc.perform(get("/applications/" + applicationIdentifier + "/beats/" + createdBeat.getIdentifier())
.accept(MediaType.APPLICATION_JSON_VALUE)
.contentType(MediaType.APPLICATION_JSON_VALUE)
.header(TENANT_HEADER, tenantDataStoreContext.getTenantName()))
.andExpect(status().isOk())
.andDo(document(
"document-get-beat", preprocessRequest(prettyPrint()),
responseFields(
fieldWithPath("identifier").description("Beat Identifier"),
fieldWithPath("alignmentHour").description("Beat Alignment Hour")
)
));
} catch (Exception e) {
e.printStackTrace();
}
}