public boolean initAndAddIssue(Issue issue) {
    DefaultInputComponent inputComponent = (DefaultInputComponent) issue.primaryLocation().inputComponent();

    if (noSonar(inputComponent, issue)) {
      return false;
    }

    ActiveRule activeRule = activeRules.find(issue.ruleKey());
    if (activeRule == null) {
      // rule does not exist or is not enabled -> ignore the issue
      return false;
    }

    ScannerReport.Issue rawIssue = createReportIssue(issue, inputComponent.scannerId(), activeRule.severity());

    if (filters.accept(inputComponent, rawIssue)) {
      write(inputComponent.scannerId(), rawIssue);
      return true;
    }
    return false;
  }
@Test
  public void filter_issue() {
    DefaultIssue issue = new DefaultIssue(project)
      .at(new DefaultIssueLocation().on(file).at(file.selectLine(3)).message(""))
      .forRule(JAVA_RULE_KEY);

    when(filters.accept(any(InputComponent.class), any(ScannerReport.Issue.class))).thenReturn(false);

    boolean added = moduleIssues.initAndAddIssue(issue);

    assertThat(added).isFalse();
    verifyNoInteractions(reportPublisher);
  }