aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2012-07-19 14:39:01 +0000
committerFabrice Bellingard <bellingard@gmail.com>2012-07-19 14:39:01 +0000
commit18ce02ea44a241694377ebd1dd36350c4220e2b6 (patch)
tree8c1d57a3ae022f0c994ce74eb824ee9f591ee90e /src/test
parentc7d65715c793f962e154310aa2b1460ebcdd86b8 (diff)
downloadsonar-scanner-cli-18ce02ea44a241694377ebd1dd36350c4220e2b6.tar.gz
sonar-scanner-cli-18ce02ea44a241694377ebd1dd36350c4220e2b6.zip
SONARPLUGINS-1230 Configure the location of working directory
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/sonar/runner/MainTest.java4
-rw-r--r--src/test/java/org/sonar/runner/RunnerTest.java24
2 files changed, 20 insertions, 8 deletions
diff --git a/src/test/java/org/sonar/runner/MainTest.java b/src/test/java/org/sonar/runner/MainTest.java
index ab324cb..3696091 100644
--- a/src/test/java/org/sonar/runner/MainTest.java
+++ b/src/test/java/org/sonar/runner/MainTest.java
@@ -49,13 +49,13 @@ public class MainTest {
@Test
public void shouldEnableDebugMode() {
Properties props = Main.parseArguments(new String[] { "-X" });
- assertThat(props.getProperty(Runner.VERBOSE), is("true"));
+ assertThat(props.getProperty(Runner.PROPERTY_VERBOSE), is("true"));
}
@Test
public void shouldDisableDebugModeByDefault() {
Properties props = Main.parseArguments(new String[] {});
- assertThat(props.getProperty(Runner.VERBOSE), nullValue());
+ assertThat(props.getProperty(Runner.PROPERTY_VERBOSE), nullValue());
}
@Test
diff --git a/src/test/java/org/sonar/runner/RunnerTest.java b/src/test/java/org/sonar/runner/RunnerTest.java
index 42c3dc9..d7fde1c 100644
--- a/src/test/java/org/sonar/runner/RunnerTest.java
+++ b/src/test/java/org/sonar/runner/RunnerTest.java
@@ -20,6 +20,12 @@
package org.sonar.runner;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.Properties;
+
+import static org.fest.assertions.Assertions.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.is;
@@ -27,11 +33,6 @@ import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
-import java.io.File;
-import java.util.Properties;
-
-import org.junit.Test;
-
public class RunnerTest {
@Test
@@ -95,7 +96,7 @@ public class RunnerTest {
Properties properties = new Properties();
Runner runner = Runner.create(properties);
assertThat("Default value", runner.isDebug(), is(false));
- properties.setProperty(Runner.VERBOSE, "true");
+ properties.setProperty(Runner.PROPERTY_VERBOSE, "true");
assertThat(runner.isDebug(), is(true));
}
@@ -126,4 +127,15 @@ public class RunnerTest {
assertThat(runner.getProjectDir().exists(), is(true));
}
+ @Test
+ public void shouldSpecifyWorkingDirectory() {
+ Properties properties = new Properties();
+ Runner runner = Runner.create(properties);
+ assertThat(runner.getWorkDir()).isEqualTo(new File(".", ".sonar"));
+
+ properties.setProperty(Runner.PROPERTY_WORK_DIRECTORY, "temp-dir");
+ runner = Runner.create(properties);
+ assertThat(runner.getWorkDir()).isEqualTo(new File(".", "temp-dir"));
+ }
+
}