public void handleRequestBody(String requestBody, String userUuid, ProjectDto projectDto) {
    // parse anticipated transitions from request body
    List<AnticipatedTransition> anticipatedTransitions = anticipatedTransitionParser.parse(requestBody, userUuid, projectDto.getKey());

    try (DbSession dbSession = dbClient.openSession(true)) {
      // delete previous anticipated transitions for the user and project
      deletePreviousAnticipatedTransitionsForUserAndProject(dbSession, userUuid, projectDto.getUuid());

      // insert new anticipated transitions
      insertAnticipatedTransitions(dbSession, anticipatedTransitions, projectDto.getUuid());
      dbSession.commit();
    }
  }
@Test
  public void givenRequestBodyWithNoTransitions_whenHandleRequestBody_thenPreviousTransitionsArePurged() {
    // given
    ProjectDto projectDto = new ProjectDto()
      .setKey(PROJECT_KEY);

    String requestBody = "body_with_no_transitions";
    doReturn(List.of())
      .when(anticipatedTransitionParser).parse(requestBody, USER_UUID, PROJECT_KEY);

    DbSession dbSession = mockDbSession();

    // when
    underTest.handleRequestBody(requestBody, USER_UUID, projectDto);

    // then
    verify(dbClient).openSession(true);
    verify(anticipatedTransitionDao).deleteByProjectAndUser(dbSession, projectDto.getUuid(), USER_UUID);
    verify(anticipatedTransitionDao, never()).insert(eq(dbSession), any());
  }