diff --git a/build.gradle b/build.gradle index cf4b4b7..f76f5f6 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,6 @@ configurations{ regressionTestsImplementation.extendsFrom compileClasspath } dependencies{ - regressionTestsImplementation group: 'commons-io', name: 'commons-io', version: '2.8.0' regressionTestsImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.7.1' regressionTestsImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.7.1' regressionTestsImplementation 'org.junit.jupiter:junit-jupiter-engine' diff --git a/src/regressionTests/java/w2phtml/regressionTests/PageBreaksBeforeHeading.java b/src/regressionTests/java/w2phtml/regressionTests/PageBreaksBeforeHeading.java index 87dfedb..d55a440 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/PageBreaksBeforeHeading.java +++ b/src/regressionTests/java/w2phtml/regressionTests/PageBreaksBeforeHeading.java @@ -6,7 +6,6 @@ import java.util.List; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -25,6 +24,6 @@ public class PageBreaksBeforeHeading { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/heading_with_page_break_before.html"); File model = new File("./testdocuments/model/heading_with_page_break_before.html"); - assertTrue( FileUtils.contentEquals(result, model),"The files differ!"); + assertTrue( TestFiles.equals(result, model),"The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/TestFiles.java b/src/regressionTests/java/w2phtml/regressionTests/TestFiles.java new file mode 100644 index 0000000..7ce6f9d --- /dev/null +++ b/src/regressionTests/java/w2phtml/regressionTests/TestFiles.java @@ -0,0 +1,23 @@ +package w2phtml.regressionTests; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.util.Arrays; + +public class TestFiles { + public static boolean equals(File file1, File file2) { + byte[] f1; + byte[] f2; + try { + f1 = Files.readAllBytes(file1.toPath()); + f2 = Files.readAllBytes(file2.toPath()); + return Arrays.equals(f1, f2); + } catch (IOException e) { + e.printStackTrace(); + } + return false; + } + + +} diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/BreakAfterTest.java b/src/regressionTests/java/w2phtml/regressionTests/html5/BreakAfterTest.java index 23a3694..cf0d8a3 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/BreakAfterTest.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/BreakAfterTest.java @@ -5,6 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.util.ArrayList; import java.util.List; +import w2phtml.regressionTests.TestFiles; import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; @@ -26,6 +27,6 @@ public class BreakAfterTest { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/" + name + ".html"); File model = new File("./testdocuments/model/" + name + ".html"); - assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + assertTrue(TestFiles.equals(result, model), "The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/BulletList.java b/src/regressionTests/java/w2phtml/regressionTests/html5/BulletList.java index af9fef7..fc860f0 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/BulletList.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/BulletList.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class BulletList { @Test @DisplayName("List on multiple pages") @@ -26,6 +27,6 @@ public class BulletList { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/" + name + ".html"); File model = new File("./testdocuments/model/" + name + ".html"); - assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + assertTrue(TestFiles.equals(result, model), "The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/GreenstoneHeadings.java b/src/regressionTests/java/w2phtml/regressionTests/html5/GreenstoneHeadings.java index 76bc96a..62ac57c 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/GreenstoneHeadings.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/GreenstoneHeadings.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class GreenstoneHeadings { @Test @DisplayName("Greenstone3 tags headings") @@ -25,6 +26,6 @@ public class GreenstoneHeadings { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/" + testName + ".html"); File model = new File("./testdocuments/model/" + testName + ".html"); - assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + assertTrue(TestFiles.equals(result, model), "The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/HardPageBreaksInLists.java b/src/regressionTests/java/w2phtml/regressionTests/html5/HardPageBreaksInLists.java index d51b66a..f177019 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/HardPageBreaksInLists.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/HardPageBreaksInLists.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class HardPageBreaksInLists { @Test @DisplayName("Hard page breaks inside list") @@ -26,6 +27,6 @@ public class HardPageBreaksInLists { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/" + name + ".html"); File model = new File("./testdocuments/model/" + name + ".html"); - assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + assertTrue(TestFiles.equals(result, model), "The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/HeadingWithSections.java b/src/regressionTests/java/w2phtml/regressionTests/html5/HeadingWithSections.java index 1f169f7..a8f3d46 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/HeadingWithSections.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/HeadingWithSections.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class HeadingWithSections { @Test @DisplayName("Heading with sections") @@ -24,6 +25,6 @@ public class HeadingWithSections { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/"+testName+".html"); File model = new File("./testdocuments/model/"+testName+".html"); - assertTrue( FileUtils.contentEquals(result, model),"The files differ!"); + assertTrue(TestFiles.equals(result, model),"The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/ImageAfterSection.java b/src/regressionTests/java/w2phtml/regressionTests/html5/ImageAfterSection.java index 4419cbb..e758227 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/ImageAfterSection.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/ImageAfterSection.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class ImageAfterSection { @Test @DisplayName("image after section") @@ -24,6 +25,6 @@ public class ImageAfterSection { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/" + testName + ".html"); File model = new File("./testdocuments/model/" + testName + ".html"); - assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + assertTrue(TestFiles.equals(result, model), "The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/ListAfterText.java b/src/regressionTests/java/w2phtml/regressionTests/html5/ListAfterText.java index d470e25..e522fb8 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/ListAfterText.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/ListAfterText.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class ListAfterText { @Test @DisplayName("List after soft page break") @@ -26,6 +27,6 @@ public class ListAfterText { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/" + name + ".html"); File model = new File("./testdocuments/model/" + name + ".html"); - assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + assertTrue(TestFiles.equals(result, model), "The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/ListInSection.java b/src/regressionTests/java/w2phtml/regressionTests/html5/ListInSection.java index 60e93cb..a9bbdfc 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/ListInSection.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/ListInSection.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class ListInSection { @Test @DisplayName("List in section") @@ -26,6 +27,6 @@ public class ListInSection { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/" + name + ".html"); File model = new File("./testdocuments/model/" + name + ".html"); - assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + assertTrue(TestFiles.equals(result, model), "The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/ListInTable.java b/src/regressionTests/java/w2phtml/regressionTests/html5/ListInTable.java index 9399d78..23dc08b 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/ListInTable.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/ListInTable.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class ListInTable { @Test @DisplayName("list in table") @@ -24,6 +25,6 @@ public class ListInTable { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/" + testName + ".html"); File model = new File("./testdocuments/model/" + testName + ".html"); - assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + assertTrue(TestFiles.equals(result, model), "The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/ListTableSection.java b/src/regressionTests/java/w2phtml/regressionTests/html5/ListTableSection.java index 5e98b01..f6f91da 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/ListTableSection.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/ListTableSection.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class ListTableSection { @Test @DisplayName("list in table in section") @@ -24,6 +25,6 @@ public class ListTableSection { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/" + testName + ".html"); File model = new File("./testdocuments/model/" + testName + ".html"); - assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + assertTrue(TestFiles.equals(result, model), "The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/PageStartWith10.java b/src/regressionTests/java/w2phtml/regressionTests/html5/PageStartWith10.java index 954dfa4..651421e 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/PageStartWith10.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/PageStartWith10.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class PageStartWith10 { @Test @DisplayName("start page from 10 in section") @@ -24,6 +25,6 @@ public class PageStartWith10 { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/" + testName + ".html"); File model = new File("./testdocuments/model/" + testName + ".html"); - assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + assertTrue(TestFiles.equals(result, model), "The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/PageStartWith10InSection.java b/src/regressionTests/java/w2phtml/regressionTests/html5/PageStartWith10InSection.java index 096c42b..5de5b90 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/PageStartWith10InSection.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/PageStartWith10InSection.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class PageStartWith10InSection { @Test @DisplayName("start page from 10") @@ -24,6 +25,6 @@ public class PageStartWith10InSection { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/" + testName + ".html"); File model = new File("./testdocuments/model/" + testName + ".html"); - assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + assertTrue(TestFiles.equals(result, model), "The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/SoftPageBreakInListTest.java b/src/regressionTests/java/w2phtml/regressionTests/html5/SoftPageBreakInListTest.java index 2c363e0..052ca71 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/SoftPageBreakInListTest.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/SoftPageBreakInListTest.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class SoftPageBreakInListTest { @Test @DisplayName("Soft page break in list") @@ -26,6 +27,6 @@ public class SoftPageBreakInListTest { w2phtml.Application.main(arguments.toArray(new String[0])); File result = new File("./testdocuments/output/" + name + ".html"); File model = new File("./testdocuments/model/" + name + ".html"); - assertTrue(FileUtils.contentEquals(result, model), "The files differ!"); + assertTrue(TestFiles.equals(result, model), "The files differ!"); } } diff --git a/src/regressionTests/java/w2phtml/regressionTests/html5/SplitFilesAlignToPages.java b/src/regressionTests/java/w2phtml/regressionTests/html5/SplitFilesAlignToPages.java index ed6282d..fe3ddf1 100644 --- a/src/regressionTests/java/w2phtml/regressionTests/html5/SplitFilesAlignToPages.java +++ b/src/regressionTests/java/w2phtml/regressionTests/html5/SplitFilesAlignToPages.java @@ -6,10 +6,11 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import w2phtml.regressionTests.TestFiles; + public class SplitFilesAlignToPages { @Test @DisplayName("Split files align to pages") @@ -28,8 +29,8 @@ public class SplitFilesAlignToPages { File result2 = new File("./testdocuments/output/" + testName + "1.html"); File model1 = new File("./testdocuments/model/" + testName + ".html"); File model2 = new File("./testdocuments/model/" + testName + "1.html"); - assertTrue(FileUtils.contentEquals(result1, model1), "The files differ!"); - assertTrue(FileUtils.contentEquals(result2, model2), "The files differ!"); + assertTrue(TestFiles.equals(result1, model1), "The files differ!"); + assertTrue(TestFiles.equals(result2, model2), "The files differ!"); } }