diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2013-12-02 10:01:43 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2013-12-02 10:01:43 +0100 |
commit | 4b3091c8008ba5a67d089593461e2c6b752a11dd (patch) | |
tree | 937563555d76ea284b03f48464d616f6d42d7d54 /sonar-core/src/test | |
parent | 587bdd4a8340bfef245e8cbfbf627a0f28d1c85d (diff) | |
download | sonarqube-4b3091c8008ba5a67d089593461e2c6b752a11dd.tar.gz sonarqube-4b3091c8008ba5a67d089593461e2c6b752a11dd.zip |
SONAR-4897 Display a message when no requirement found
Diffstat (limited to 'sonar-core/src/test')
-rw-r--r-- | sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtManagerTest.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtManagerTest.java b/sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtManagerTest.java index 4adfd392eeb..a20cb142ee9 100644 --- a/sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtManagerTest.java +++ b/sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtManagerTest.java @@ -89,6 +89,17 @@ public class DefaultTechnicalDebtManagerTest { } @Test + public void not_find_requirement() throws Exception { + Rule rule = Rule.create("repo", "key"); + rule.setId(1); + + when(dao.selectByRuleId(rule.getId())).thenReturn(null); + + Characteristic result = finder.findRequirementByRule(rule); + assertThat(result).isNull(); + } + + @Test public void find_characteristic() throws Exception { Rule rule = Rule.create("repo", "key"); rule.setId(1); @@ -104,4 +115,15 @@ public class DefaultTechnicalDebtManagerTest { assertThat(result.key()).isEqualTo("COMPILER_RELATED_PORTABILITY"); assertThat(result.name()).isEqualTo("Compiler"); } + + @Test + public void not_find_characteristic() throws Exception { + Rule rule = Rule.create("repo", "key"); + rule.setId(1); + + when(dao.selectById(rule.getId())).thenReturn(null); + + Characteristic result = finder.findCharacteristicById(2); + assertThat(result).isNull(); + } } |