aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/test/java/org/sonar/api/resources/QualifiersTest.java
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2017-01-17 17:45:09 +0100
committerDuarte Meneses <duarte.meneses@sonarsource.com>2017-01-27 16:26:30 +0100
commiteea589c564a924993e8edba9d8fa9691e756bce4 (patch)
treec112f6d41d7f4dfeb7ad8d14f895e1b879a68411 /sonar-plugin-api/src/test/java/org/sonar/api/resources/QualifiersTest.java
parent211a993bd85b5d12ace1686b133677381da8c597 (diff)
downloadsonarqube-eea589c564a924993e8edba9d8fa9691e756bce4.tar.gz
sonarqube-eea589c564a924993e8edba9d8fa9691e756bce4.zip
Refactor resources API
Diffstat (limited to 'sonar-plugin-api/src/test/java/org/sonar/api/resources/QualifiersTest.java')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/QualifiersTest.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/QualifiersTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/QualifiersTest.java
index 36b82b87df5..acfc2ed17bf 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/QualifiersTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/QualifiersTest.java
@@ -20,6 +20,7 @@
package org.sonar.api.resources;
import org.junit.Test;
+import org.sonar.api.batch.bootstrap.ProjectDefinition;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
@@ -46,7 +47,10 @@ public class QualifiersTest {
@Test
public void testProject() {
- Resource root = new Project("foo");
+ ProjectDefinition rootDef = ProjectDefinition.create();
+ ProjectDefinition moduleDef = ProjectDefinition.create();
+ rootDef.addSubProject(moduleDef);
+ Resource root = new Project(rootDef);
assertThat(Qualifiers.isView(root, true), is(false));
assertThat(Qualifiers.isView(root, false), is(false));
assertThat(Qualifiers.isProject(root, true), is(true));
@@ -55,7 +59,10 @@ public class QualifiersTest {
@Test
public void testModule() {
- Resource sub = new Project("sub").setParent(new Project("root"));
+ ProjectDefinition rootDef = ProjectDefinition.create();
+ ProjectDefinition moduleDef = ProjectDefinition.create();
+ rootDef.addSubProject(moduleDef);
+ Resource sub = new Project(moduleDef);
assertThat(Qualifiers.isView(sub, true), is(false));
assertThat(Qualifiers.isView(sub, false), is(false));
assertThat(Qualifiers.isProject(sub, true), is(true));
@@ -119,5 +126,3 @@ public class QualifiersTest {
}
}
}
-
-