From 5ef18dfd1e5214b276fbb9912cb0ce9e8ae44e0c Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 4 Jun 2013 19:18:54 +0200 Subject: [PATCH] Fix unit test --- .../core/issue/DefaultIssueQueryResultTest.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueQueryResultTest.java b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueQueryResultTest.java index 85dcf9ba163..7f442ea19a7 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueQueryResultTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueQueryResultTest.java @@ -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.emptyList()); + result.first(); + } + @Test public void test_first_issue() { - DefaultIssueQueryResult result = new DefaultIssueQueryResult(Collections.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(); -- 2.39.5