public boolean setCodeVariants(DefaultIssue issue, Set<String> currentCodeVariants, IssueChangeContext context) {
    Set<String> newCodeVariants = getNewCodeVariants(issue);
    if (!currentCodeVariants.equals(newCodeVariants)) {
      issue.setFieldChange(context, CODE_VARIANTS,
        currentCodeVariants.isEmpty() ? null : CHANGELOG_LIST_JOINER.join(currentCodeVariants),
        newCodeVariants.isEmpty() ? null : CHANGELOG_LIST_JOINER.join(newCodeVariants));
      issue.setCodeVariants(newCodeVariants);
      issue.setUpdateDate(context.date());
      issue.setChanged(true);
      issue.setSendNotifications(true);
      return true;
    }
    return false;
  }
@Test
  void setCodeVariants_whenCodeVariantAdded_shouldBeUpdated() {
    Set<String> currentCodeVariants = new HashSet<>(Arrays.asList("linux"));
    Set<String> newCodeVariants = new HashSet<>(Arrays.asList("linux", "windows"));

    issue.setCodeVariants(newCodeVariants);
    boolean updated = underTest.setCodeVariants(issue, currentCodeVariants, context);
    assertThat(updated).isTrue();
    assertThat(issue.codeVariants()).contains("linux", "windows");

    FieldDiffs.Diff diff = issue.currentChange().get("code_variants");
    assertThat(diff.oldValue()).isEqualTo("linux");
    assertThat(diff.newValue()).isEqualTo("linux windows");
    assertThat(issue.mustSendNotifications()).isTrue();
  }