### Question:
AbstractAnsibleSensor implements Sensor { protected void saveIssue(SensorContext context, InputFile inputFile, int line, String ruleId, String message) { RuleKey ruleKey = getRuleKey(context, ruleId); if (ruleKey == null) { ruleKey = getRuleKey(context, "E" + ruleId); } if (ruleKey == null) { LOGGER.debug("Rule " + ruleId + " ignored, not found in repository"); return; } NewIssue newIssue = context.newIssue().forRule(ruleKey); NewIssueLocation location = newIssue.newLocation() .on(inputFile) .message(message) .at(inputFile.selectLine(line)); newIssue.at(location).save(); LOGGER.debug("Issue {} saved for {}", ruleId, inputFile.filename()); } protected  AbstractAnsibleSensor(FileSystem fileSystem);   }### Answer:
@Test public void testSaveIssue() throws IOException { InputFile playbook = Utils.getInputFile("playbooks/playbook1.yml"); logTester.clear(); sensor.saveIssue(context, playbook, 2, "foo", "An error here"); assertEquals(1, logTester.logs(LoggerLevel.DEBUG).size()); assertEquals("Rule foo ignored, not found in repository", logTester.logs(LoggerLevel.DEBUG).get(0)); logTester.clear(); sensor.saveIssue(context, playbook, 2, RULE_ID2, "An error here"); assertEquals(1, context.allIssues().size()); Issue issue = (Issue)context.allIssues().toArray()[0]; assertEquals(ruleKey2, issue.ruleKey()); IssueLocation location = issue.primaryLocation(); assertEquals(playbook.key(), location.inputComponent().key()); assertEquals(2, location.textRange().start().line()); assertEquals("An error here", location.message()); }