diff options
| author | Elena Vilchik | 2019-06-12 11:53:55 +0200 |
|---|---|---|
| committer | Tibor Blenessy | 2019-06-12 11:53:55 +0200 |
| commit | fd0139f0673ceaeabab4db3112cf18fff69f3c81 (patch) | |
| tree | d1faf835fabcf185e6c56442d40d8c288aa526b8 /sonar-css-plugin/src/test | |
| parent | 5e1b4ef423a1ca5943232ad332d3230d9d09ec82 (diff) | |
| download | sonar-css-fd0139f0673ceaeabab4db3112cf18fff69f3c81.tar.bz2 | |
Support stylelint report in different encoding (#176)
Diffstat (limited to 'sonar-css-plugin/src/test')
3 files changed, 36 insertions, 1 deletions
diff --git a/sonar-css-plugin/src/test/java/org/sonar/css/plugin/StylelintReportSensorTest.java b/sonar-css-plugin/src/test/java/org/sonar/css/plugin/StylelintReportSensorTest.java index 295cf7f..62974d9 100644 --- a/sonar-css-plugin/src/test/java/org/sonar/css/plugin/StylelintReportSensorTest.java +++ b/sonar-css-plugin/src/test/java/org/sonar/css/plugin/StylelintReportSensorTest.java @@ -71,7 +71,7 @@ public class StylelintReportSensorTest { } @Test - public void should_add_issues_from_report() throws Exception { + public void should_add_issues_from_report() { setReport("report.json"); stylelintReportSensor.execute(context); @@ -91,6 +91,24 @@ public class StylelintReportSensorTest { } @Test + public void should_read_report_utf8_bom() { + setReport("report-utf8-bom.json"); + stylelintReportSensor.execute(context); + + Collection<ExternalIssue> externalIssues = context.allExternalIssues(); + assertThat(externalIssues).hasSize(2); + } + + @Test + public void should_read_report_utf16() { + setReport("report-utf16.json"); + stylelintReportSensor.execute(context); + + Collection<ExternalIssue> externalIssues = context.allExternalIssues(); + assertThat(externalIssues).hasSize(2); + } + + @Test public void should_support_absolute_file_paths_in_report() throws Exception { String report = "[\n" + " {\n" + diff --git a/sonar-css-plugin/src/test/resources/stylelint-report/report-utf16.json b/sonar-css-plugin/src/test/resources/stylelint-report/report-utf16.json Binary files differnew file mode 100644 index 0000000..1fd449a --- /dev/null +++ b/sonar-css-plugin/src/test/resources/stylelint-report/report-utf16.json diff --git a/sonar-css-plugin/src/test/resources/stylelint-report/report-utf8-bom.json b/sonar-css-plugin/src/test/resources/stylelint-report/report-utf8-bom.json new file mode 100644 index 0000000..4f685c4 --- /dev/null +++ b/sonar-css-plugin/src/test/resources/stylelint-report/report-utf8-bom.json @@ -0,0 +1,17 @@ +[ + { + "source": "file.css", + "warnings": [ + { + "line": 1, + "rule": "color-no-invalid-hex", + "text": "external issue message (color-no-invalid-hex)" + }, + { + "line": 1, + "rule": "comment-no-empty", + "text": "external issue message (comment-no-empty)" + } + ] + } +] |
