aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-04-16 13:44:34 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-04-16 13:44:34 +0200
commitf514ebde313dcf27afcd4806bf33f4426e59835e (patch)
tree43fe06daad9e468121a6386e5115bff52269e8bb
parent108dc916996e3075eb21c6ae1bbc7c9a24f09ab0 (diff)
downloadsonarqube-f514ebde313dcf27afcd4806bf33f4426e59835e.tar.gz
sonarqube-f514ebde313dcf27afcd4806bf33f4426e59835e.zip
Add unit test when issuable is null
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/IssuesDecoratorTest.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/IssuesDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/IssuesDecoratorTest.java
index 9d7697b5343..3f05624a9ec 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/IssuesDecoratorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/IssuesDecoratorTest.java
@@ -89,6 +89,17 @@ public class IssuesDecoratorTest {
verify(context).saveMeasure(CoreMetrics.ISSUES, 4.0);
}
+ @Test
+ public void should_do_nothing_when_issuable_is_null() {
+ ResourcePerspectives perspectives = mock(ResourcePerspectives.class);
+ when(perspectives.as(Issuable.class, resource)).thenReturn(null);
+ IssuesDecorator decorator = new IssuesDecorator(perspectives, rulefinder);
+
+ decorator.decorate(resource, context);
+
+ verifyZeroInteractions(context);
+ }
+
/**
* See http://jira.codehaus.org/browse/SONAR-1729
*/