Claudenw commented on code in PR #576:
URL: https://github.com/apache/creadur-rat/pull/576#discussion_r2516059917
##########
apache-rat-core/src/test/java/org/apache/rat/ReporterOptionsProvider.java:
##########
@@ -920,58 +877,53 @@ private void styleSheetTest(final Option option) {
String actualText = baos.toString(StandardCharsets.UTF_8.name());
TextUtils.assertContainsExactly(1, "Hello world", actualText);
- } catch (IOException | RatException e) {
+ } catch (IOException | ParseException | RatException e) {
fail(e.getMessage(), e);
} finally {
System.setOut(origin);
}
}
- @OptionCollectionTest.TestFunction
- protected void stylesheetTest() {
- styleSheetTest(Arg.OUTPUT_STYLE.find("stylesheet"));
- }
-
@OptionCollectionTest.TestFunction
protected void outputStyleTest() {
styleSheetTest(Arg.OUTPUT_STYLE.find("output-style"));
}
- @OptionCollectionTest.TestFunction
- protected void xmlTest() {
- PrintStream origin = System.out;
- Option option = Arg.OUTPUT_STYLE.find("xml");
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (PrintStream out = new PrintStream(baos)) {
- System.setOut(out);
- configureSourceDir(option);
- // create a dummy stylesheet so that we match the stylesheet tests.
- File file = writeFile("stylesheet", "<xsl:stylesheet
version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n" +
- " <xsl:template match=\"@*|node()\">\n" +
- " Hello world\n" +
- " </xsl:template>\n" +
- "</xsl:stylesheet>");
-
- ReportConfiguration config =
generateConfig(ImmutablePair.of(option, null));
- Reporter reporter = new Reporter(config);
- ClaimStatistic claimStatistic = reporter.output();
-
assertThat(claimStatistic.getCounter(ClaimStatistic.Counter.STANDARDS)).isEqualTo(1);
-
assertThat(claimStatistic.getCounter(ClaimStatistic.Counter.APPROVED)).isEqualTo(0);
-
assertThat(claimStatistic.getCounter(ClaimStatistic.Counter.UNAPPROVED)).isEqualTo(1);
-
- String actualText = baos.toString(StandardCharsets.UTF_8.name());
- TextUtils.assertContainsExactly(1, "<resource
encoding=\"ISO-8859-1\" mediaType=\"text/plain\" name=\"/stylesheet\"
type=\"STANDARD\">", actualText);
-
- try (InputStream expected = StyleSheets.getStyleSheet("xml").get();
- InputStream actual = config.getStyleSheet().get()) {
- assertThat(IOUtils.contentEquals(expected, actual)).as("'xml'
does not match").isTrue();
- }
- } catch (IOException | RatException e) {
- fail(e.getMessage(), e);
- } finally {
- System.setOut(origin);
- }
- }
+// @OptionCollectionTest.TestFunction
Review Comment:
Code is removed as it was a duplicate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]