void saveGroups()

in ddm-rrm/src/it/java/com/epam/digital/data/platform/management/CandidateVersionGroupsControllerIT.java [64:108]


  void saveGroups() {
    // create version candidate
    final var versionCandidateId = context.createVersionCandidate();

    // perform request
    final var requestBody = GroupListDetails.builder()
        .groups(List.of(GroupDetails.builder().name("111")
                .processDefinitions(List.of("bp-1-process_definition_id", "bp-2-process_definition_id"))
                .build(),
            GroupDetails.builder().name("222")
                .processDefinitions(List.of("bp-3-process_definition_id")).build(),
            //Very long group name to test yaml mapper split line configuration
            GroupDetails.builder().name("1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888")
                    .processDefinitions(new ArrayList<>()).build()))
        .ungrouped(List.of("bp-4-process_definition_id", "bp-5-process_definition_id")).build();


    mockMvc.perform(
        post("/versions/candidates/{versionCandidateId}/business-process-groups", versionCandidateId)
            .accept(MediaType.APPLICATION_JSON)
            .contentType(MediaType.APPLICATION_JSON)
            .content(new ObjectMapper().writeValueAsString(requestBody))
    ).andExpectAll(
        status().isOk(),
        content().contentType(MediaType.APPLICATION_JSON),
        jsonPath("$.groups[0].name", is("111")),
        jsonPath("$.groups[0].processDefinitions", hasSize(0)),
        jsonPath("$.groups[1].name", is("222")),
        jsonPath("$.groups[1].processDefinitions", hasSize(0)),
        //Very long group name to test yaml mapper split line configuration
        jsonPath("$.groups[2].name", is("1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888")),
        jsonPath("$.groups[2].processDefinitions", hasSize(0)),
        jsonPath("$.ungrouped", hasSize(0))
    );

    // define expected files contents
    final var expectedGroupingContent = context.getResourceContent(
        "/versions/candidates/{versionCandidateId}/bp-grouping/POST/bp-grouping.yml");

    final var actualGroupingContent = context.getFileFromRemoteVersionCandidateRepo(
        "bp-grouping/bp-grouping.yml");

    Assertions.assertThat(actualGroupingContent)
        .isEqualTo(expectedGroupingContent);
  }