This is an automated email from the ASF dual-hosted git repository.

pottlinger pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/creadur-rat.git

commit 187fc8cfb056e8f73375ef159d4de02534a4715a
Author: Hugo Hirsch <[email protected]>
AuthorDate: Mon Jan 27 22:41:17 2020 +0100

    RAT-262: Fix tests after adding JSON example data
---
 apache-rat-core/.gitignore                                           | 1 +
 .../java/org/apache/rat/document/impl/guesser/BinaryGuesser.java     | 4 +++-
 apache-rat-core/src/test/java/org/apache/rat/ReportTest.java         | 3 ++-
 .../test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java    | 5 +++--
 .../src/test/java/org/apache/rat/report/xml/XmlReportTest.java       | 5 +++--
 5 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/apache-rat-core/.gitignore b/apache-rat-core/.gitignore
new file mode 100644
index 0000000..b83d222
--- /dev/null
+++ b/apache-rat-core/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git 
a/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java
 
b/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java
index daccc48..312140e 100644
--- 
a/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java
+++ 
b/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java
@@ -228,7 +228,9 @@ public class BinaryGuesser {
             "RAJ", "CERT",
             "KS", "ODP", "SWF",
             // fonts
-            "WOFF2", "WOFF", "TTF", "EOT"
+            "WOFF2", "WOFF", "TTF", "EOT",
+            // JSON structure does not allow comments/license injections in 
the way RAT expects it
+            "JSON"
     };
 
     private static final String[] EXE_EXTENSIONS = {
diff --git a/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java 
b/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java
index e69a79d..444a61c 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java
@@ -48,7 +48,7 @@ public class ReportTest {
     private static String getElementsReports(String pElementsPath) {
         return
                 NL + "Notes: 2" + NL +//
-                        "Binaries: 1" + NL +//
+                        "Binaries: 2" + NL +//
                         "Archives: 1" + NL +//
                         "Standards: 7" + NL +//
                         "" + NL +//
@@ -88,6 +88,7 @@ public class ReportTest {
                         "  AL    " + pElementsPath + "/Xml.xml" + NL +//
                         "  AL    " + pElementsPath + "/buildr.rb" + NL +//
                         "  A     " + pElementsPath + "/dummy.jar" + NL +//
+                        "  B     " + pElementsPath + "/plain.json" + NL +//
                         " !????? " + pElementsPath + "/sub/Empty.txt" + NL +//
                         " " + NL +//
                         PARAGRAPH + NL +//
diff --git 
a/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java
 
b/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java
index 2b48f24..3cb1fd3 100644
--- 
a/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java
+++ 
b/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java
@@ -88,10 +88,11 @@ public class XmlReportFactoryTest {
                 "</resource>" +
                 "<resource name='" + elementsPath + "/buildr.rb'><type 
name='standard'/>" +
                 "</resource>" +
-                "<resource name='" + elementsPath + "/dummy.jar'><type 
name='archive'/></resource>" +
+                           "<resource name='" + elementsPath + 
"/dummy.jar'><type name='archive'/></resource>" +
+                           "<resource name='" + elementsPath + 
"/plain.json'><type name='binary'/></resource>" +
                                    "</rat-report>"));
         assertTrue("Is well formed", XmlUtils.isWellFormedXml(output));
-        assertEquals("Binary files", Integer.valueOf(1), 
statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_BINARY));
+        assertEquals("Binary files", Integer.valueOf(2), 
statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_BINARY));
         assertEquals("Notice files", Integer.valueOf(2), 
statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_NOTICE));
         assertEquals("Standard files", Integer.valueOf(6), 
statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_STANDARD));
         assertEquals("Archives", Integer.valueOf(1), 
statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_ARCHIVE));
diff --git 
a/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java 
b/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java
index 3d6f597..ef23042 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java
@@ -86,7 +86,7 @@ public class XmlReportTest {
         assertTrue("Preamble and document element are OK",
                    output.startsWith("<?xml version='1.0'?>" +
                 "<rat-report timestamp="));
-        assertTrue("Part after timestamp attribute is OK",
+        assertTrue(output+"Part after timestamp attribute is OK",
                    output.endsWith(">" +
                     "<resource name='" + elementsPath + "/Image.png'><type 
name='binary'/></resource>" +
                     "<resource name='" + elementsPath + "/LICENSE'><type 
name='notice'/></resource>" +
@@ -208,7 +208,8 @@ public class XmlReportTest {
 "end\n" +
 "\n" +
                 "</header-sample><header-type name='?????'/><license-family 
name='?????'/><type name='standard'/></resource>" +
-                    "<resource name='" + elementsPath + "/dummy.jar'><type 
name='archive'/></resource>" +
+                           "<resource name='" + elementsPath + 
"/dummy.jar'><type name='archive'/></resource>" +
+                           "<resource name='" + elementsPath + 
"/plain.json'><type name='binary'/></resource>" +
                     "<resource name='" + elementsPath + 
"/sub/Empty.txt'><header-sample>\n</header-sample><header-type 
name='?????'/><license-family name='?????'/><type name='standard'/></resource>" 
+
                     "</rat-report>"));
         assertTrue("Is well formed", XmlUtils.isWellFormedXml(output));

Reply via email to