in component-test/src/main/java/org/apache/fineract/cn/rhythm/RhythmApiDocumentation.java [76:108]
public void documentCreateBeat ( ) throws Exception {
final String applicationIdentifier = "funnybusiness-v1";
final String oldBeatId = "oldBeatIdentifier123";
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));
Beat newBeat = new Beat();
newBeat.setIdentifier(oldBeatId);
newBeat.setAlignmentHour(expectedBeatTimestamp.getHour());
Gson gson = new Gson();
this.mockMvc.perform(post("/applications/" + applicationIdentifier + "/beats")
.accept(MediaType.APPLICATION_JSON_VALUE)
.contentType(MediaType.APPLICATION_JSON_VALUE)
.header(TENANT_HEADER, tenantDataStoreContext.getTenantName())
.content(gson.toJson(newBeat)))
.andExpect(status().isAccepted())
.andDo(document(
"document-create-beat", preprocessRequest(prettyPrint()),
requestFields(
fieldWithPath("identifier").description("Beat Identifier"),
fieldWithPath("alignmentHour").description("Beat Alignment Hour")
)
));
}