aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2018-09-21 19:05:15 +0200
committerSonarTech <sonartech@sonarsource.com>2018-09-24 20:20:58 +0200
commit04cc1592790ad76f86706ed36160f3e5ca480f7a (patch)
tree78687580cd4c433e67469cd69db76d5d414ce531 /sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol
parent04963a43f10710b0992c1ef708183f05723c7025 (diff)
downloadsonarqube-04cc1592790ad76f86706ed36160f3e5ca480f7a.tar.gz
sonarqube-04cc1592790ad76f86706ed36160f3e5ca480f7a.zip
SONAR-11209 remove space in ad hoc rule names
Diffstat (limited to 'sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol')
-rw-r--r--sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java2
-rw-r--r--sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java24
2 files changed, 24 insertions, 2 deletions
diff --git a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java
index 6791f83a5f4..cd92d2af88b 100644
--- a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java
+++ b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java
@@ -109,7 +109,7 @@ public class ScannerReportReaderTest {
ScannerReportWriter writer = new ScannerReportWriter(dir);
ScannerReport.ExternalIssue issue = ScannerReport.ExternalIssue.newBuilder()
.build();
- writer.writeComponentExternalIssues(1, asList(issue));
+ writer.appendComponentExternalIssue(1, issue);
assertThat(underTest.readComponentExternalIssues(1)).hasSize(1);
assertThat(underTest.readComponentExternalIssues(200)).isEmpty();
diff --git a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java
index ffcd97aaa8f..0b426b0092e 100644
--- a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java
+++ b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java
@@ -28,6 +28,7 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.sonar.core.util.CloseableIterator;
import org.sonar.core.util.Protobuf;
+import org.sonar.scanner.protocol.Constants;
import org.sonar.scanner.protocol.output.ScannerReport.Component.ComponentType;
import org.sonar.scanner.protocol.output.ScannerReport.Measure.DoubleValue;
import org.sonar.scanner.protocol.output.ScannerReport.SyntaxHighlightingRule.HighlightingType;
@@ -126,7 +127,7 @@ public class ScannerReportWriterTest {
.setMsg("the message")
.build();
- underTest.writeComponentExternalIssues(1, asList(issue));
+ underTest.appendComponentExternalIssue(1, issue);
assertThat(underTest.hasComponentData(FileStructure.Domain.EXTERNAL_ISSUES, 1)).isTrue();
File file = underTest.getFileStructure().fileFor(FileStructure.Domain.EXTERNAL_ISSUES, 1);
@@ -137,6 +138,27 @@ public class ScannerReportWriterTest {
}
@Test
+ public void write_adhoc_rule() {
+
+ // write data
+ ScannerReport.AdHocRule rule = ScannerReport.AdHocRule.newBuilder()
+ .setEngineId("eslint")
+ .setRuleId("123")
+ .setName("Foo")
+ .setDescription("Description")
+ .setSeverity(Constants.Severity.BLOCKER)
+ .setType(ScannerReport.IssueType.BUG)
+ .build();
+ underTest.appendAdHocRule(rule);
+
+ File file = underTest.getFileStructure().adHocRules();
+ assertThat(file).exists().isFile();
+ try (CloseableIterator<ScannerReport.AdHocRule> read = Protobuf.readStream(file, ScannerReport.AdHocRule.parser())) {
+ assertThat(Iterators.size(read)).isEqualTo(1);
+ }
+ }
+
+ @Test
public void write_changed_lines() {
assertThat(underTest.hasComponentData(FileStructure.Domain.CHANGED_LINES, 1)).isFalse();