public boolean setType(DefaultIssue issue, RuleType type, IssueChangeContext context) {
    if (!Objects.equals(type, issue.type())) {
      issue.setFieldChange(context, TYPE, issue.type(), type);
      issue.setType(type);
      issue.setUpdateDate(context.date());
      issue.setChanged(true);
      return true;
    }
    return false;
  }
@Test
  void set_type() {
    issue.setType(RuleType.CODE_SMELL);
    boolean updated = underTest.setType(issue, RuleType.BUG, context);
    assertThat(updated).isTrue();
    assertThat(issue.type()).isEqualTo(RuleType.BUG);
    assertThat(issue.manualSeverity()).isFalse();
    assertThat(issue.mustSendNotifications()).isFalse();

    FieldDiffs.Diff diff = issue.currentChange().get(TYPE);
    assertThat(diff.oldValue()).isEqualTo(RuleType.CODE_SMELL);
    assertThat(diff.newValue()).isEqualTo(RuleType.BUG);
  }