diff options
author | Fabrice Bellingard <fabrice.bellingard@sonarsource.com> | 2012-09-06 11:18:18 +0200 |
---|---|---|
committer | Fabrice Bellingard <fabrice.bellingard@sonarsource.com> | 2012-09-06 11:18:18 +0200 |
commit | 84cf7f1fb4491a955dcd6b4e10a9510f06666db8 (patch) | |
tree | 866d2b0a16485993d639d76f1ccf00e985da96be /src | |
parent | ad6e774541d5c8d2d9b9df2981c2f2255455898f (diff) | |
download | sonar-scanner-cli-84cf7f1fb4491a955dcd6b4e10a9510f06666db8.tar.gz sonar-scanner-cli-84cf7f1fb4491a955dcd6b4e10a9510f06666db8.zip |
SONARPLUGINS-2203 Improve tests
Diffstat (limited to 'src')
12 files changed, 46 insertions, 21 deletions
diff --git a/src/test/java/org/sonar/runner/model/SonarProjectBuilderTest.java b/src/test/java/org/sonar/runner/model/SonarProjectBuilderTest.java index fe22db6..d27e88c 100644 --- a/src/test/java/org/sonar/runner/model/SonarProjectBuilderTest.java +++ b/src/test/java/org/sonar/runner/model/SonarProjectBuilderTest.java @@ -57,6 +57,18 @@ public class SonarProjectBuilderTest { } @Test + public void shouldDefineSimpleProjectWithDeprecatedProperties() throws IOException { + ProjectDefinition projectDefinition = loadProjectDefinition("simple-project-with-deprecated-props"); + + assertThat(projectDefinition.getSourceDirs()).contains("sources"); + assertThat(projectDefinition.getTestDirs()).contains("tests"); + assertThat(projectDefinition.getBinaries()).contains("target/classes"); + assertThat(projectDefinition.getLibraries()).contains( + TestUtils.getResource(this.getClass(), "simple-project-with-deprecated-props/libs/lib2.txt").getAbsolutePath(), + TestUtils.getResource(this.getClass(), "simple-project-with-deprecated-props/libs/lib2.txt").getAbsolutePath()); + } + + @Test public void shouldFailIfUnexistingSourceDirectory() throws IOException { thrown.expect(RunnerException.class); thrown.expectMessage("The source folder 'unexisting-source-dir' does not exist for 'com.foo.project' project/module (base directory = " diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-file/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-file/sonar-project.properties index 4c655a7..782fd4e 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-file/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-file/sonar-project.properties @@ -3,9 +3,9 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=sources -tests=tests -binaries=target/classes +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes sonar.modules=module1 diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-path/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-path/sonar-project.properties index 202de2e..ce5fa00 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-path/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-path/sonar-project.properties @@ -3,9 +3,9 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=sources -tests=tests -binaries=target/classes +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes sonar.modules=module1 diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-basedir/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-basedir/sonar-project.properties index 7249f0a..67fbf34 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-basedir/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-basedir/sonar-project.properties @@ -3,9 +3,9 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=sources -tests=tests -binaries=target/classes +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes sonar.modules=module1 diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-file/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-file/sonar-project.properties index 4c655a7..782fd4e 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-file/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module-with-unexisting-file/sonar-project.properties @@ -3,9 +3,9 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=sources -tests=tests -binaries=target/classes +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes sonar.modules=module1 diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module/sonar-project.properties index 96eb03d..4e29926 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/multi-module/sonar-project.properties @@ -3,9 +3,9 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=sources -tests=tests -binaries=target/classes +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes sonar.modules=module1,\ module2 @@ -17,4 +17,4 @@ module2.sonar.projectKey=com.foo.project.module2 module2.sonar.projectName=Foo Module 2 # redefine some properties module2.sonar.projectDescription=Description of Module 2 -module2.sources=src +module2.sonar.sources=src diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/libs/lib1.txt b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/libs/lib1.txt new file mode 100644 index 0000000..81d4e95 --- /dev/null +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/libs/lib1.txt @@ -0,0 +1 @@ +lib1
\ No newline at end of file diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/libs/lib2.txt b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/libs/lib2.txt new file mode 100644 index 0000000..7dacac0 --- /dev/null +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/libs/lib2.txt @@ -0,0 +1 @@ +lib2
\ No newline at end of file diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/sonar-project.properties new file mode 100644 index 0000000..acf3c83 --- /dev/null +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/sonar-project.properties @@ -0,0 +1,10 @@ +sonar.projectKey=com.foo.project +sonar.projectName=Foo Project +sonar.projectVersion=1.0-SNAPSHOT +sonar.projectDescription=Description of Foo Project + +# Those are the deprecated properties +sources=sources +tests=tests +binaries=target/classes +libraries=libs/*.txt diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/sources/Fake.java b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/sources/Fake.java new file mode 100644 index 0000000..5967658 --- /dev/null +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-deprecated-props/sources/Fake.java @@ -0,0 +1 @@ +Fake
\ No newline at end of file diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-unexisting-source-dir/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-unexisting-source-dir/sonar-project.properties index 3ce2bb0..0b83b11 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-unexisting-source-dir/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project-with-unexisting-source-dir/sonar-project.properties @@ -3,4 +3,4 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=unexisting-source-dir +sonar.sources=unexisting-source-dir diff --git a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project/sonar-project.properties b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project/sonar-project.properties index 81bdf16..ea8a1b5 100644 --- a/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/model/SonarProjectBuilderTest/simple-project/sonar-project.properties @@ -3,7 +3,7 @@ sonar.projectName=Foo Project sonar.projectVersion=1.0-SNAPSHOT sonar.projectDescription=Description of Foo Project -sources=sources -tests=tests -binaries=target/classes -libraries=libs/*.txt +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes +sonar.libraries=libs/*.txt |