public GroupInformation updateGroup(DbSession dbSession, GroupDto group, @Nullable String newName) {
    checkGroupIsNotDefault(dbSession, group);
    return groupDtoToGroupInformation(updateName(dbSession, group, newName), dbSession);
  }
@Test
  public void updateGroup_whenGroupExist_throws() {
    GroupDto group = mockGroupDto();
    GroupDto group2 = mockGroupDto();
    mockDefaultGroup();
    String group2Name = GROUP_NAME + "2";

    when(dbClient.groupDao().selectByName(dbSession, group2Name)).thenReturn(Optional.of(group2));

    assertThatExceptionOfType(BadRequestException.class)
      .isThrownBy(() -> groupService.updateGroup(dbSession, group, group2Name, "New Description"))
      .withMessage("Group '" + group2Name + "' already exists");

    assertThatExceptionOfType(BadRequestException.class)
      .isThrownBy(() -> groupService.updateGroup(dbSession, group, group2Name))
      .withMessage("Group '" + group2Name + "' already exists");
  }