### Question:
IssuesProvider { protected static SqlIssue mapToSqlIssue(FoundMatch m) { SqlIssue e = new SqlIssue(); e.repo = m.sqlRules.getRepoKey(); e.line = m.getLine(); try { if (StringUtils.equalsIgnoreCase("LINEAR", m.rule.getRemediationFunction()) && !StringUtils.isBlank(m.rule.getDebtRemediationFunctionCoefficient())) { e.debtRemediationEffort = org.sonar.api.utils.Duration .decode(m.rule.getDebtRemediationFunctionCoefficient(), 8).toMinutes(); } } catch (Exception p) { } e.description = m.rule.getDescription(); e.ruleType = m.rule.getRuleType(); e.key = m.rule.getKey(); e.severity = m.rule.getSeverity(); e.isAdhoc = m.sqlRules.isIsAdhoc(); e.message = m.rule.getRuleImplementation().getRuleViolationMessage(); e.name = m.rule.getName(); e.isExternal = m.sqlRules.getIsExternal(); return e; }  SqlIssuesList analyze(AntlrContext ctx);  }### Answer:
@Test public void testMapEmpty() { FoundMatch match = new FoundMatch(); match.sqlRules = new SqlRules(); match.rule = new Rule(); SqlIssue issue = IssuesProvider.mapToSqlIssue(match); Assert.assertEquals(0, issue.getDebtRemediationEffort()); }
@Test public void testMapLinear() { FoundMatch match = new FoundMatch(); match.sqlRules = new SqlRules(); match.rule = new Rule(); match.rule.setRemediationFunction("LINEAR"); SqlIssue issue = IssuesProvider.mapToSqlIssue(match); Assert.assertEquals(0, issue.getDebtRemediationEffort()); }
@Test public void testMapLinearDefault() { FoundMatch match = new FoundMatch(); match.sqlRules = new SqlRules(); match.rule = new Rule(); match.rule.setRemediationFunction("LINEAR"); match.rule.setDebtRemediationFunctionCoefficient("1h 10min"); SqlIssue issue = IssuesProvider.mapToSqlIssue(match); Assert.assertEquals(70, issue.getDebtRemediationEffort()); }
@Test public void testMapLinearWithInvalidValues() { FoundMatch match = new FoundMatch(); match.sqlRules = new SqlRules(); match.rule = new Rule(); match.rule.setRemediationFunction("LINEAR"); match.rule.setDebtRemediationFunctionCoefficient("1t"); SqlIssue issue = IssuesProvider.mapToSqlIssue(match); Assert.assertEquals(0, issue.getDebtRemediationEffort()); }