]> source.dussan.org Git - sonarqube.git/commitdiff
Fix unit test
authorJulien Lancelot <julien.lancelot@gmail.com>
Tue, 4 Jun 2013 17:18:54 +0000 (19:18 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Tue, 4 Jun 2013 17:18:54 +0000 (19:18 +0200)
sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueQueryResultTest.java

index 85dcf9ba1637d4b97adda5f7d34596a5129f7fea..7f442ea19a7c31073122ffb314845fa0a5f11501 100644 (file)
@@ -26,13 +26,21 @@ import org.sonar.api.issue.internal.DefaultIssue;
 import java.util.Arrays;
 import java.util.Collections;
 
+import static com.google.common.collect.Lists.newArrayList;
 import static org.fest.assertions.Assertions.assertThat;
 
 public class DefaultIssueQueryResultTest {
+
+  @Test(expected = IllegalArgumentException.class)
+  public void should_first_throw_exception_if_no_issue() {
+    DefaultIssueQueryResult result = new DefaultIssueQueryResult(Collections.<Issue>emptyList());
+    result.first();
+  }
+
   @Test
   public void test_first_issue() {
-    DefaultIssueQueryResult result = new DefaultIssueQueryResult(Collections.<Issue>emptyList());
-    assertThat(result.first()).isNull();
+    DefaultIssueQueryResult result = new DefaultIssueQueryResult(newArrayList((Issue) new DefaultIssue()));
+    assertThat(result.first()).isNotNull();
 
     Issue first = new DefaultIssue();
     Issue second = new DefaultIssue();