public void documentDeleteBeat()

in component-test/src/main/java/org/apache/fineract/cn/rhythm/RhythmApiDocumentation.java [189:218]


  public void documentDeleteBeat ( ) throws InterruptedException {
    final String applicationIdentifier = "interestingbusiness-v2";
    final String oldBeatId = "beatIdentifier789";

    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);

    final List <Beat> allEntities = super.testSubject.getAllBeatsForApplication(applicationIdentifier);
    Assert.assertTrue(allEntities.contains(createdBeat));

    try {
      this.mockMvc.perform(delete("/applications/" + applicationIdentifier + "/beats/" + createdBeat.getIdentifier())
              .accept(MediaType.ALL_VALUE)
              .contentType(MediaType.ALL_VALUE)
              .header(TENANT_HEADER, tenantDataStoreContext.getTenantName()))
              .andExpect(status().isAccepted())
              .andDo(document("document-delete-beat"));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }