orchestrator.getServer().associateProjectToQualityProfile("java:sample", "java", "sonar-way");
SonarScanner build = newScanner(new File("projects/java-sample"))
- .setProperty("sonar.verbose", "true")
- .addArguments("-e");
+ .setProperty("sonar.verbose", "true");
// SONARPLUGINS-3061
// Add a trailing slash
build.setProperty("sonar.host.url", orchestrator.getServer().getUrl() + "/");
assertThat(parseInt(fileMeasures.get("violations").getValue())).isGreaterThan(0);
}
+ /**
+ * Only tests, no sources
+ */
+ @Test
+ public void scan_java_tests() {
+ orchestrator.getServer().restoreProfile(ResourceLocation.create("/sonar-way-profile.xml"));
+ orchestrator.getServer().provisionProject("java:sampletest", "Java Sample");
+ orchestrator.getServer().associateProjectToQualityProfile("java:sampletest", "java", "sonar-way");
+
+ SonarScanner build = newScanner(new File("projects/java-sample"))
+ .setProperty("sonar.projectKey", "java:sampletest")
+ .setProperty("sonar.tests", "src")
+ .setProperty("sonar.sources", "");
+ orchestrator.executeBuild(build);
+
+ Component file = getComponent("java:sampletest:src/basic/Hello.java");
+ assertThat(file.getName()).isEqualTo("Hello.java");
+ assertThat(file.getQualifier()).isEqualTo("UTS");
+ }
+
@Test
public void scan_java_sources_and_bytecode() {
orchestrator.getServer().restoreProfile(ResourceLocation.create("/requires-bytecode-profile.xml"));
<groupId>org.sonarsource.scanner.cli</groupId>
<artifactId>sonar-scanner-cli</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>SonarQube Scanner</name>
<url>http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner</url>
*/
package org.sonarsource.scanner.cli;
-import static org.assertj.core.api.Assertions.assertThat;
-
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import static org.assertj.core.api.Assertions.assertThat;
+
public class PropertyResolverTest {
@Rule
public ExpectedException exception = ExpectedException.none();
PropertyResolver resolver = new PropertyResolver(map, env);
resolver.resolve();
}
+
+ @Test
+ public void preserve_empty() {
+ Properties map = new Properties();
+ Map<String, String> env = new HashMap<>();
+
+ map.put("A", "");
+ map.put("B", "${A}");
+
+ PropertyResolver resolver = new PropertyResolver(map, env);
+ Properties resolved = resolver.resolve();
+ assertThat(resolved.get("A")).isEqualTo("");
+ assertThat(resolved.get("B")).isEqualTo("");
+ }
}