aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2016-07-07 15:28:47 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2016-07-08 11:13:27 +0200
commitce748e217f599da5efb043bb847738b4f6aa9f23 (patch)
tree107b4c5287977574cc1c2af58974f046e00c1fbf /sonar-scanner-engine
parent169b22e13d1bd50cf582eeb00d3231d3b8392d28 (diff)
downloadsonarqube-ce748e217f599da5efb043bb847738b4f6aa9f23.tar.gz
sonarqube-ce748e217f599da5efb043bb847738b4f6aa9f23.zip
SONAR-7783 Ensure Sensors don't save same data twice
Diffstat (limited to 'sonar-scanner-engine')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java
index aa07798bfaa..e44b7085951 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java
@@ -93,6 +93,31 @@ public class HighlightingMediumTest {
}
@Test
+ public void saveTwice() throws IOException {
+ File baseDir = temp.newFolder();
+ File srcDir = new File(baseDir, "src");
+ srcDir.mkdir();
+
+ File xooFile = new File(srcDir, "sample.xoo");
+ FileUtils.write(xooFile, "Sample xoo\ncontent plop");
+
+ exception.expect(UnsupportedOperationException.class);
+ exception.expectMessage("Trying to save highlighting twice for the same file is not supported");
+ tester.newTask()
+ .properties(ImmutableMap.<String, String>builder()
+ .put("sonar.projectBaseDir", baseDir.getAbsolutePath())
+ .put("sonar.projectKey", "com.foo.project")
+ .put("sonar.projectName", "Foo Project")
+ .put("sonar.projectVersion", "1.0-SNAPSHOT")
+ .put("sonar.projectDescription", "Description of Foo Project")
+ .put("sonar.sources", "src")
+ .put("sonar.it.savedatatwice", "true")
+ .build())
+ .start();
+
+ }
+
+ @Test
public void computeInvalidOffsets() throws IOException {
File baseDir = temp.newFolder();
@@ -118,7 +143,7 @@ public class HighlightingMediumTest {
}
});
- TaskResult result = tester.newTask()
+ tester.newTask()
.properties(ImmutableMap.<String, String>builder()
.put("sonar.projectBaseDir", baseDir.getAbsolutePath())
.put("sonar.projectKey", "com.foo.project")