]> source.dussan.org Git - sonarqube.git/commitdiff
Add test on searching issues on view without project
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 27 Jul 2017 15:31:47 +0000 (17:31 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 31 Jul 2017 09:27:51 +0000 (11:27 +0200)
server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java

index 3e47b6a916fbb540e40d6df56a5d609e4509c401..48194e6b71a95e77e64b6c471acdd9569d3f5adf 100644 (file)
@@ -63,6 +63,8 @@ import org.sonar.server.view.index.ViewIndexer;
 
 import static com.google.common.collect.ImmutableSortedSet.of;
 import static java.util.Arrays.asList;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singletonList;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.entry;
 import static org.mockito.Mockito.mock;
@@ -298,6 +300,18 @@ public class IssueIndexTest {
     assertThatSearchReturnsEmpty(IssueQuery.builder().viewUuids(asList("unknown")));
   }
 
+  @Test
+  public void filter_by_views_not_having_projects() {
+    OrganizationDto organizationDto = newOrganizationDto();
+    ComponentDto project1 = ComponentTesting.newPrivateProjectDto(organizationDto);
+    ComponentDto file1 = newFileDto(project1, null);
+    indexIssues(newDoc("I2", file1));
+    String view1 = "ABCD";
+    indexView(view1, emptyList());
+
+    assertThatSearchReturnsOnly(IssueQuery.builder().viewUuids(singletonList(view1)));
+  }
+
   @Test
   public void filter_by_created_after_by_projects() {
     Date now = new Date();