Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFEndnote.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFEndnote.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFEndnote.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFEndnote.java Thu Dec 24 18:42:29 2020 @@ -16,27 +16,27 @@ ==================================================================== */ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import java.io.IOException; import java.math.BigInteger; import java.util.List; import org.apache.poi.xwpf.XWPFTestDataSamples; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdnRef; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR; public class TestXWPFEndnote { - + private XWPFDocument docOut; private String p1Text; private String p2Text; private BigInteger endnoteId; private XWPFEndnote endnote; - @Before + @BeforeEach public void setUp() { docOut = new XWPFDocument(); p1Text = "First paragraph in footnote"; @@ -46,115 +46,112 @@ public class TestXWPFEndnote { // to XWPFEndnotes.createEndnote() so this tests // both creation of new XWPFEndnotes in document // and XWPFEndnotes.createEndnote(); - + // NOTE: Creating the endnote does not automatically // create a first paragraph. endnote = docOut.createEndnote(); endnoteId = endnote.getId(); - + } @Test public void testAddParagraphsToFootnote() throws IOException { - // Add a run to the first paragraph: - + // Add a run to the first paragraph: + XWPFParagraph p1 = endnote.createParagraph(); p1.createRun().setText(p1Text); - + // Create a second paragraph: - + XWPFParagraph p = endnote.createParagraph(); - assertNotNull("Paragraph is null", p); + assertNotNull(p, "Paragraph is null"); p.createRun().setText(p2Text); XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut); - + XWPFEndnote testEndnote = docIn.getEndnoteByID(endnoteId.intValue()); assertNotNull(testEndnote); - + assertEquals(2, testEndnote.getParagraphs().size()); XWPFParagraph testP1 = testEndnote.getParagraphs().get(0); assertEquals(p1Text, testP1.getText()); XWPFParagraph testP2 = testEndnote.getParagraphs().get(1); - assertEquals(p2Text, testP2.getText()); - + assertEquals(p2Text, testP2.getText()); + // The first paragraph added using createParagraph() should // have the required footnote reference added to the first // run. - + // Verify that we have a footnote reference in the first paragraph and not // in the second paragraph. - + XWPFRun r1 = testP1.getRuns().get(0); assertNotNull(r1); - assertTrue("No endnote reference in testP1", r1.getCTR().getEndnoteRefList().size() > 0); - assertNotNull("No endnote reference in testP1", r1.getCTR().getEndnoteRefArray(0)); + assertTrue(r1.getCTR().getEndnoteRefList().size() > 0, "No endnote reference in testP1"); + assertNotNull(r1.getCTR().getEndnoteRefArray(0), "No endnote reference in testP1"); XWPFRun r2 = testP2.getRuns().get(0); - assertNotNull("Expected a run in testP2", r2); - assertEquals("Found an endnote reference in testP2", 0, r2.getCTR().getEndnoteRefList().size()); - + assertNotNull(r2, "Expected a run in testP2"); + assertEquals(0, r2.getCTR().getEndnoteRefList().size(), "Found an endnote reference in testP2"); + } - + @Test public void testAddTableToFootnote() throws IOException { XWPFTable table = endnote.createTable(); assertNotNull(table); - + XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut); - + XWPFEndnote testFootnote = docIn.getEndnoteByID(endnoteId.intValue()); XWPFTable testTable = testFootnote.getTableArray(0); assertNotNull(testTable); - + table = endnote.createTable(2, 3); assertEquals(2, table.getNumberOfRows()); assertEquals(3, table.getRow(0).getTableCells().size()); - + // If the table is the first body element of the footnote then // a paragraph with the footnote reference should have been // added automatically. - - assertEquals("Expected 3 body elements", 3, endnote.getBodyElements().size()); + + assertEquals(3, endnote.getBodyElements().size(), "Expected 3 body elements"); IBodyElement testP1 = endnote.getBodyElements().get(0); - assertTrue("Expected a paragraph, got " + testP1.getClass().getSimpleName() , testP1 instanceof XWPFParagraph); + assertTrue(testP1 instanceof XWPFParagraph, "Expected a paragraph, got " + testP1.getClass().getSimpleName()); XWPFRun r1 = ((XWPFParagraph)testP1).getRuns().get(0); assertNotNull(r1); - assertTrue("No footnote reference in testP1", r1.getCTR().getEndnoteRefList().size() > 0); - assertNotNull("No footnote reference in testP1", r1.getCTR().getEndnoteRefArray(0)); + assertTrue(r1.getCTR().getEndnoteRefList().size() > 0, "No footnote reference in testP1"); + assertNotNull(r1.getCTR().getEndnoteRefArray(0), "No footnote reference in testP1"); } - + @Test public void testRemoveEndnote() { - // NOTE: XWPFDocument.removeEndnote() delegates directly to + // NOTE: XWPFDocument.removeEndnote() delegates directly to // XWPFEndnotes. docOut.createEndnote(); - assertEquals("Expected 2 endnotes", 2, docOut.getEndnotes().size()); - assertNotNull("Didn't get second endnote", docOut.getEndnotes().get(1)); + assertEquals(2, docOut.getEndnotes().size(), "Expected 2 endnotes"); + assertNotNull(docOut.getEndnotes().get(1), "Didn't get second endnote"); boolean result = docOut.removeEndnote(0); - assertTrue("Remove endnote did not return true", result); - assertEquals("Expected 1 endnote after removal", 1, docOut.getEndnotes().size()); + assertTrue(result, "Remove endnote did not return true"); + assertEquals(1, docOut.getEndnotes().size(), "Expected 1 endnote after removal"); } @Test public void testAddFootnoteRefToParagraph() { XWPFParagraph p = docOut.createParagraph(); List<XWPFRun> runs = p.getRuns(); - assertEquals("Expected no runs in new paragraph", 0, runs.size()); + assertEquals(0, runs.size(), "Expected no runs in new paragraph"); p.addFootnoteReference(endnote); XWPFRun run = p.getRuns().get(0); CTR ctr = run.getCTR(); - assertNotNull("Expected a run", run); + assertNotNull(run, "Expected a run"); List<CTFtnEdnRef> endnoteRefList = ctr.getEndnoteReferenceList(); assertNotNull(endnoteRefList); CTFtnEdnRef ref = endnoteRefList.get(0); assertNotNull(ref); - assertEquals("Endnote ID and reference ID did not match", endnote.getId(), ref.getId()); - - + assertEquals(endnote.getId(), ref.getId(), "Endnote ID and reference ID did not match"); } - }
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFEndnotes.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFEndnotes.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFEndnotes.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFEndnotes.java Thu Dec 24 18:42:29 2020 @@ -17,15 +17,15 @@ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; import java.io.IOException; import java.math.BigInteger; import org.apache.poi.xwpf.XWPFTestDataSamples; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.wordprocessingml.x2006.main.STFtnEdn; public class TestXWPFEndnotes { Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnote.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnote.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnote.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnote.java Thu Dec 24 18:42:29 2020 @@ -16,27 +16,27 @@ ==================================================================== */ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import java.io.IOException; import java.math.BigInteger; import java.util.List; import org.apache.poi.xwpf.XWPFTestDataSamples; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdnRef; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR; public class TestXWPFFootnote { - + private XWPFDocument docOut; private String p1Text; private String p2Text; private BigInteger footnoteId; private XWPFFootnote footnote; - @Before + @BeforeEach public void setUp() { docOut = new XWPFDocument(); p1Text = "First paragraph in footnote"; @@ -46,115 +46,114 @@ public class TestXWPFFootnote { // to XWPFFootnotes.createFootnote() so this tests // both creation of new XWPFFootnotes in document // and XWPFFootnotes.createFootnote(); - + // NOTE: Creating the footnote does not automatically // create a first paragraph. footnote = docOut.createFootnote(); footnoteId = footnote.getId(); - + } @Test public void testAddParagraphsToFootnote() throws IOException { - // Add a run to the first paragraph: - + // Add a run to the first paragraph: + XWPFParagraph p1 = footnote.createParagraph(); p1.createRun().setText(p1Text); - + // Create a second paragraph: - + XWPFParagraph p = footnote.createParagraph(); - assertNotNull("Paragraph is null", p); + assertNotNull(p, "Paragraph is null"); p.createRun().setText(p2Text); XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut); - + XWPFFootnote testFootnote = docIn.getFootnoteByID(footnoteId.intValue()); assertNotNull(testFootnote); - + assertEquals(2, testFootnote.getParagraphs().size()); XWPFParagraph testP1 = testFootnote.getParagraphs().get(0); assertEquals(p1Text, testP1.getText()); XWPFParagraph testP2 = testFootnote.getParagraphs().get(1); - assertEquals(p2Text, testP2.getText()); - + assertEquals(p2Text, testP2.getText()); + // The first paragraph added using createParagraph() should // have the required footnote reference added to the first // run. - + // Verify that we have a footnote reference in the first paragraph and not // in the second paragraph. - + XWPFRun r1 = testP1.getRuns().get(0); assertNotNull(r1); - assertTrue("No footnote reference in testP1", r1.getCTR().getFootnoteRefList().size() > 0); - assertNotNull("No footnote reference in testP1", r1.getCTR().getFootnoteRefArray(0)); + assertTrue(r1.getCTR().getFootnoteRefList().size() > 0, "No footnote reference in testP1"); + assertNotNull(r1.getCTR().getFootnoteRefArray(0), "No footnote reference in testP1"); XWPFRun r2 = testP2.getRuns().get(0); - assertNotNull("Expected a run in testP2", r2); - assertEquals("Found a footnote reference in testP2", 0, r2.getCTR().getFootnoteRefList().size()); - + assertNotNull(r2, "Expected a run in testP2"); + assertEquals(0, r2.getCTR().getFootnoteRefList().size(), "Found a footnote reference in testP2"); + } - + @Test public void testAddTableToFootnote() throws IOException { XWPFTable table = footnote.createTable(); assertNotNull(table); - + XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut); - + XWPFFootnote testFootnote = docIn.getFootnoteByID(footnoteId.intValue()); XWPFTable testTable = testFootnote.getTableArray(0); assertNotNull(testTable); - + table = footnote.createTable(2, 3); assertEquals(2, table.getNumberOfRows()); assertEquals(3, table.getRow(0).getTableCells().size()); - + // If the table is the first body element of the footnote then // a paragraph with the footnote reference should have been // added automatically. - - assertEquals("Expected 3 body elements", 3, footnote.getBodyElements().size()); + + assertEquals(3, footnote.getBodyElements().size(), "Expected 3 body elements"); IBodyElement testP1 = footnote.getBodyElements().get(0); - assertTrue("Expected a paragraph, got " + testP1.getClass().getSimpleName() , testP1 instanceof XWPFParagraph); + assertTrue(testP1 instanceof XWPFParagraph, "Expected a paragraph, got " + testP1.getClass().getSimpleName()); XWPFRun r1 = ((XWPFParagraph)testP1).getRuns().get(0); assertNotNull(r1); - assertTrue("No footnote reference in testP1", r1.getCTR().getFootnoteRefList().size() > 0); - assertNotNull("No footnote reference in testP1", r1.getCTR().getFootnoteRefArray(0)); - + assertTrue(r1.getCTR().getFootnoteRefList().size() > 0, "No footnote reference in testP1"); + assertNotNull(r1.getCTR().getFootnoteRefArray(0), "No footnote reference in testP1"); } - + @Test public void testRemoveFootnote() { - // NOTE: XWPFDocument.removeFootnote() delegates directly to + // NOTE: XWPFDocument.removeFootnote() delegates directly to // XWPFFootnotes. docOut.createFootnote(); - assertEquals("Expected 2 footnotes", 2, docOut.getFootnotes().size()); - assertNotNull("Didn't get second footnote", docOut.getFootnotes().get(1)); + assertEquals(2, docOut.getFootnotes().size(), "Expected 2 footnotes"); + assertNotNull(docOut.getFootnotes().get(1), "Didn't get second footnote"); boolean result = docOut.removeFootnote(0); - assertTrue("Remove footnote did not return true", result); - assertEquals("Expected 1 footnote after removal", 1, docOut.getFootnotes().size()); + assertTrue(result, "Remove footnote did not return true"); + assertEquals(1, docOut.getFootnotes().size(), "Expected 1 footnote after removal"); } @Test public void testAddFootnoteRefToParagraph() { XWPFParagraph p = docOut.createParagraph(); List<XWPFRun> runs = p.getRuns(); - assertEquals("Expected no runs in new paragraph", 0, runs.size()); + assertEquals(0, runs.size(), "Expected no runs in new paragraph"); p.addFootnoteReference(footnote); XWPFRun run = p.getRuns().get(0); CTR ctr = run.getCTR(); - assertNotNull("Expected a run", run); + assertNotNull(run, "Expected a run"); CTFtnEdnRef ref = ctr.getFootnoteReferenceList().get(0); assertNotNull(ref); // FIXME: Verify that the footnote reference is w:endnoteReference, not w:footnoteReference - assertEquals("Footnote ID and reference ID did not match", footnote.getId(), ref.getId()); - - - + assertEquals(footnote.getId(), ref.getId(), "Footnote ID and reference ID did not match"); + + + } } Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java Thu Dec 24 18:42:29 2020 @@ -22,12 +22,12 @@ import java.math.BigInteger; import java.util.List; import org.apache.poi.xwpf.XWPFTestDataSamples; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.wordprocessingml.x2006.main.STFtnEdn; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; public class TestXWPFFootnotes { @Test @@ -81,7 +81,7 @@ public class TestXWPFFootnotes { } } } - assertEquals("Load footnotes once", 1, hits); + assertEquals(1, hits, "Load footnotes once"); } } } Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeader.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeader.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeader.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeader.java Thu Dec 24 18:42:29 2020 @@ -17,16 +17,16 @@ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import java.io.IOException; import org.apache.poi.xwpf.XWPFTestDataSamples; import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText; @@ -231,25 +231,25 @@ public final class TestXWPFHeader { } } - @Ignore + @Disabled @Test public void testAddPictureData() { // TODO } - @Ignore + @Disabled @Test public void testGetAllPictures() { // TODO } - @Ignore + @Disabled @Test public void testGetAllPackagePictures() { // TODO } - @Ignore + @Disabled @Test public void testGetPictureDataById() { // TODO Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeadings.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeadings.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeadings.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeadings.java Thu Dec 24 18:42:29 2020 @@ -19,12 +19,12 @@ package org.apache.poi.xwpf.usermodel; import java.io.IOException; import org.apache.poi.xwpf.XWPFTestDataSamples; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtBlock; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; /** * @author Paolo Mottadelli Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java Thu Dec 24 18:42:29 2020 @@ -17,15 +17,15 @@ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.math.BigInteger; import org.apache.poi.xwpf.XWPFTestDataSamples; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAbstractNum; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTNum; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTNumLvl; Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java Thu Dec 24 18:42:29 2020 @@ -17,18 +17,18 @@ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.math.BigInteger; import java.util.List; import org.apache.poi.xwpf.XWPFTestDataSamples; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture; import org.openxmlformats.schemas.drawingml.x2006.picture.PicDocument; import org.openxmlformats.schemas.drawingml.x2006.picture.impl.PicDocumentImpl; @@ -771,7 +771,7 @@ public final class TestXWPFParagraph { str.append(par.getText()).append("\n"); } String s = str.toString(); - assertTrue("Having text: \n" + s + "\nTrimmed length: " + s.trim().length(), s.trim().length() > 0); + assertTrue(s.trim().length() > 0, "Having text: \n" + s + "\nTrimmed length: " + s.trim().length()); } } Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java Thu Dec 24 18:42:29 2020 @@ -17,11 +17,12 @@ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.fail; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -32,8 +33,8 @@ import org.apache.poi.openxml4j.opc.Pack import org.apache.poi.xssf.usermodel.XSSFRelation; import org.apache.poi.xwpf.XWPFTestDataSamples; import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class TestXWPFPictureData { @@ -127,9 +128,7 @@ public class TestXWPFPictureData { // Document shouldn't have any image relationships assertEquals(13, doc.getPackagePart().getRelationships().size()); for (PackageRelationship rel : doc.getPackagePart().getRelationships()) { - if (rel.getRelationshipType().equals(XSSFRelation.IMAGE_JPEG.getRelation())) { - fail("Shouldn't have JPEG yet"); - } + assertNotEquals(XSSFRelation.IMAGE_JPEG.getRelation(), rel.getRelationshipType(), "Shouldn't have JPEG yet"); } // Add the image @@ -145,12 +144,11 @@ public class TestXWPFPictureData { PackageRelationship jpegRel = null; for (PackageRelationship rel : doc.getPackagePart().getRelationships()) { if (rel.getRelationshipType().equals(XWPFRelation.IMAGE_JPEG.getRelation())) { - if (jpegRel != null) - fail("Found 2 jpegs!"); + assertNull(jpegRel, "Found 2 jpegs!"); jpegRel = rel; } } - assertNotNull("JPEG Relationship not found", jpegRel); + assertNotNull(jpegRel, "JPEG Relationship not found"); // Check the details assertNotNull(jpegRel); @@ -185,7 +183,7 @@ public class TestXWPFPictureData { .map(XWPFRun::getEmbeddedPictures) .flatMap(List::stream) .map(XWPFPicture::getPictureData) - .forEach(Assert::assertNull); + .forEach(Assertions::assertNull); } } } Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java Thu Dec 24 18:42:29 2020 @@ -16,11 +16,11 @@ ==================================================================== */ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -35,9 +35,9 @@ import org.apache.poi.util.Units; import org.apache.poi.wp.usermodel.HeaderFooterType; import org.apache.poi.xwpf.XWPFTestDataSamples; import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip; import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties; import org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture; @@ -64,7 +64,7 @@ public class TestXWPFRun { private IRunBody irb; private XWPFDocument doc; - @Before + @BeforeEach public void setUp() { doc = new XWPFDocument(); p = doc.createParagraph(); @@ -73,7 +73,7 @@ public class TestXWPFRun { this.ctRun = CTR.Factory.newInstance(); } - @After + @AfterEach public void tearDown() throws Exception { doc.close(); } @@ -788,7 +788,7 @@ public class TestXWPFRun { String styleId = "bolditalic"; run.setStyle(styleId); String candStyleId = run.getCTR().getRPr().getRStyleArray(0).getVal(); - assertNotNull("Expected to find a run style ID", candStyleId); + assertNotNull( candStyleId, "Expected to find a run style ID" ); assertEquals(styleId, candStyleId); assertEquals(styleId, run.getStyle()); Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java Thu Dec 24 18:42:29 2020 @@ -18,15 +18,15 @@ package org.apache.poi.xwpf.usermodel; import static org.apache.poi.POITestCase.assertContains; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.poi.xwpf.XWPFTestDataSamples; -import org.junit.Test; +import org.junit.jupiter.api.Test; public final class TestXWPFSDT { @@ -37,7 +37,7 @@ public final class TestXWPFSDT { public void testNestedSDTs() throws Exception { try (XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug64561.docx")) { XWPFAbstractSDT sdt = extractAllSDTs(doc).get(0); - assertEquals("extracted text", "Subject", sdt.getContent().getText()); + assertEquals("Subject", sdt.getContent().getText(), "extracted text"); } } @@ -58,10 +58,10 @@ public final class TestXWPFSDT { } } - assertEquals("controls size", 13, sdts.size()); + assertEquals(13, sdts.size(), "controls size"); - assertEquals("tag", "MyTag", tag); - assertEquals("title", "MyTitle", title); + assertEquals("MyTag", tag, "tag"); + assertEquals("MyTitle", title, "title"); } } @@ -86,11 +86,11 @@ public final class TestXWPFSDT { try (XWPFDocument doc =XWPFTestDataSamples.openSampleDocument("Bug54849.docx")) { List<XWPFAbstractSDT> sdts = extractAllSDTs(doc); - assertEquals("number of sdts", contents.length, sdts.size()); + assertEquals(contents.length, sdts.size(), "number of sdts"); for (int i = 0; i < contents.length; i++) { XWPFAbstractSDT sdt = sdts.get(i); - assertEquals(i + ": " + contents[i], contents[i], sdt.getContent().toString()); + assertEquals(contents[i], sdt.getContent().toString(), i + ": " + contents[i]); } } } @@ -100,7 +100,7 @@ public final class TestXWPFSDT { */ @Test public void testSDTAsCell() throws Exception { - //Bug54771a.docx and Bug54771b.docx test slightly + //Bug54771a.docx and Bug54771b.docx test slightly //different recursion patterns. Keep both! try (XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug54771a.docx")) { List<XWPFAbstractSDT> sdts = extractAllSDTs(doc); @@ -146,7 +146,7 @@ public final class TestXWPFSDT { for (int i = 0; i < sdts.size(); i++) { XWPFAbstractSDT sdt = sdts.get(i); - assertEquals(targs.get(i), targs.get(i), sdt.getContent().getText()); + assertEquals(targs.get(i), sdt.getContent().getText()); } } } Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSmartTag.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSmartTag.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSmartTag.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSmartTag.java Thu Dec 24 18:42:29 2020 @@ -21,7 +21,7 @@ import static org.apache.poi.POITestCase import java.io.IOException; import org.apache.poi.xwpf.XWPFTestDataSamples; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Tests for reading SmartTags from Word docx. Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFStyles.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFStyles.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFStyles.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFStyles.java Thu Dec 24 18:42:29 2020 @@ -17,19 +17,19 @@ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.poi.xwpf.XWPFTestDataSamples; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLatentStyles; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLsdException; @@ -214,18 +214,14 @@ public final class TestXWPFStyles { XWPFStyles styles = doc.getStyles(); // Styles exist in the test document in this order, EmptyCellLayoutStyle // is missing a StyleId - try { - assertNotNull(styles.getStyle("NoList")); - assertNull(styles.getStyle("EmptyCellLayoutStyle")); - assertNotNull(styles.getStyle("BalloonText")); - - // Bug 64600: styleExist throws NPE - assertTrue(styles.styleExist("NoList")); - assertFalse(styles.styleExist("EmptyCellLayoutStyle")); - assertTrue(styles.styleExist("BalloonText")); - } catch (NullPointerException e) { - fail(e.toString()); - } + assertNotNull(styles.getStyle("NoList")); + assertNull(styles.getStyle("EmptyCellLayoutStyle")); + assertNotNull(styles.getStyle("BalloonText")); + + // Bug 64600: styleExist throws NPE + assertTrue(styles.styleExist("NoList")); + assertFalse(styles.styleExist("EmptyCellLayoutStyle")); + assertTrue(styles.styleExist("BalloonText")); } } @@ -237,7 +233,7 @@ public final class TestXWPFStyles { String styleName = "Normal Table"; XWPFStyle style = styles.getStyleWithName(styleName); - assertNotNull("Expected to find style \"" + styleName + "\"", style); + assertNotNull(style, "Expected to find style \"" + styleName + "\""); assertEquals(styleName, style.getName()); } } Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTable.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTable.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTable.java Thu Dec 24 18:42:29 2020 @@ -16,9 +16,9 @@ ==================================================================== */ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import java.io.IOException; import java.math.BigInteger; @@ -26,7 +26,7 @@ import java.util.List; import org.apache.poi.xwpf.XWPFTestDataSamples; import org.apache.poi.xwpf.usermodel.XWPFTable.XWPFBorderType; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow; @@ -553,15 +553,15 @@ public class TestXWPFTable { // assert the table is empty List<XWPFTableRow> rows = table.getRows(); - assertEquals("Table has less rows than requested.", noRows, rows.size()); + assertEquals(noRows, rows.size(), "Table has less rows than requested."); for (XWPFTableRow xwpfRow : rows) { assertNotNull(xwpfRow); for (int i = 0; i < 7; i++) { XWPFTableCell xwpfCell = xwpfRow.getCell(i); assertNotNull(xwpfCell); - assertEquals("Empty cells should not have one paragraph.", 1, xwpfCell.getParagraphs().size()); + assertEquals(1, xwpfCell.getParagraphs().size(), "Empty cells should not have one paragraph."); xwpfCell = xwpfRow.getCell(i); - assertEquals("Calling 'getCell' must not modify cells content.", 1, xwpfCell.getParagraphs().size()); + assertEquals(1, xwpfCell.getParagraphs().size(), "Calling 'getCell' must not modify cells content."); } } doc.getPackage().revert(); Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java Thu Dec 24 18:42:29 2020 @@ -19,12 +19,12 @@ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.apache.poi.xwpf.XWPFTestDataSamples; import org.apache.poi.xwpf.usermodel.XWPFTableCell.XWPFVertAlign; @@ -132,7 +132,7 @@ public class TestXWPFTableCell { } // This is not a very useful test as written. It is not worth the execution time for a unit test - @Ignore + @Disabled @Test public void testCellVerticalAlignShouldNotThrowNPE() throws Exception { XWPFDocument docx = XWPFTestDataSamples.openSampleDocument("TestTableCellAlign.docx"); Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableRow.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableRow.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableRow.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableRow.java Thu Dec 24 18:42:29 2020 @@ -17,15 +17,15 @@ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import org.apache.poi.xwpf.XWPFTestDataSamples; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHeightRule; public class TestXWPFTableRow { @@ -51,7 +51,7 @@ public class TestXWPFTableRow { // Assert the repeat header is false by default boolean isCantSplit = tr.isCantSplitRow(); assertFalse(isCantSplit); - + // Repeat the header tr.setCantSplitRow(true); isCantSplit = tr.isCantSplitRow(); @@ -61,7 +61,7 @@ public class TestXWPFTableRow { tr.setCantSplitRow(false); isCantSplit = tr.isCantSplitRow(); assertFalse(isCantSplit); - + doc.close(); } @@ -73,11 +73,11 @@ public class TestXWPFTableRow { // table has a single row by default; grab it XWPFTableRow tr = table.getRow(0); assertNotNull(tr); - + // Assert the repeat header is false by default boolean isRpt = tr.isRepeatHeader(); assertFalse(isRpt); - + // Repeat the header tr.setRepeatHeader(true); isRpt = tr.isRepeatHeader(); @@ -87,7 +87,7 @@ public class TestXWPFTableRow { tr.setRepeatHeader(false); isRpt = tr.isRepeatHeader(); assertFalse(isRpt); - + // If the third row is set to repeat, but not the second, // isRepeatHeader should report false because Word will // ignore it. @@ -95,10 +95,10 @@ public class TestXWPFTableRow { tr.setRepeatHeader(true); isRpt = tr.isRepeatHeader(); assertFalse(isRpt); - + doc.close(); } - + // Test that validates the table header value can be parsed from a document // generated in Word @Test @@ -119,8 +119,8 @@ public class TestXWPFTableRow { assertFalse(isRpt); } } - - + + // Test that validates the table header value can be parsed from a document // generated in Word @Test Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/XWPFAbstractNumTest.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/XWPFAbstractNumTest.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/XWPFAbstractNumTest.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/XWPFAbstractNumTest.java Thu Dec 24 18:42:29 2020 @@ -16,9 +16,9 @@ ==================================================================== */ package org.apache.poi.xwpf.usermodel; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class XWPFAbstractNumTest { Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java Thu Dec 24 18:42:29 2020 @@ -17,17 +17,17 @@ package org.apache.poi.hdgf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import org.apache.poi.POIDataSamples; import org.apache.poi.hdgf.extractor.VisioTextExtractor; import org.apache.poi.hdgf.streams.PointerContainingStream; import org.apache.poi.hdgf.streams.TrailerStream; import org.apache.poi.poifs.filesystem.POIFSFileSystem; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public final class TestHDGFCore { private static POIDataSamples _dgTests = POIDataSamples.getDiagramInstance(); @@ -36,11 +36,11 @@ public final class TestHDGFCore { private HDGFDiagram hdgf; private VisioTextExtractor textExtractor; - @Before + @BeforeEach public void setUp() throws Exception { fs = new POIFSFileSystem(_dgTests.openResourceAsStream("Test_Visio-Some_Random_Text.vsd")); } - @After + @AfterEach public void tearDown() throws Exception { if (textExtractor != null) textExtractor.close(); if (hdgf != null) hdgf.close(); Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java Thu Dec 24 18:42:29 2020 @@ -17,13 +17,13 @@ package org.apache.poi.hdgf; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.ByteArrayInputStream; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; public final class TestHDGFLZW { public static final byte[] testTrailerComp = { Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java Thu Dec 24 18:42:29 2020 @@ -17,22 +17,22 @@ package org.apache.poi.hdgf.chunks; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import org.apache.poi.hdgf.chunks.ChunkFactory.CommandDefinition; import org.apache.poi.poifs.storage.RawDataUtil; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public final class TestChunks { private static byte[] data_a, data_b; - @BeforeClass + @BeforeAll public static void setup() throws IOException { data_a = RawDataUtil.decompress( "H4sIAAAAAAAAAHNjYGD4DwRMQNqFAQygFAMTWAIbYIBqQqZRARMSOwNKMwOxChAzMoRIACkeNC3MUAwDjEjGTEISb" + Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/dev/TestVSDDumper.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/dev/TestVSDDumper.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/dev/TestVSDDumper.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/dev/TestVSDDumper.java Thu Dec 24 18:42:29 2020 @@ -25,20 +25,20 @@ import java.io.PrintStream; import org.apache.poi.POIDataSamples; import org.apache.poi.util.NullPrintStream; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class TestVSDDumper { private static PrintStream oldStdOut; - @BeforeClass + @BeforeAll public static void muteStdout() { oldStdOut = System.out; System.setOut(new NullPrintStream()); } - @AfterClass + @AfterAll public static void restoreStdout() { System.setOut(oldStdOut); } Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java Thu Dec 24 18:42:29 2020 @@ -17,8 +17,8 @@ package org.apache.poi.hdgf.extractor; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.IOException; import java.io.InputStream; @@ -26,7 +26,7 @@ import java.io.InputStream; import org.apache.poi.POIDataSamples; import org.apache.poi.hdgf.HDGFDiagram; import org.apache.poi.poifs.filesystem.POIFSFileSystem; -import org.junit.Test; +import org.junit.jupiter.api.Test; public final class TestVisioExtractor { private static final POIDataSamples _dgTests = POIDataSamples.getDiagramInstance(); Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java Thu Dec 24 18:42:29 2020 @@ -17,11 +17,12 @@ package org.apache.poi.hdgf.pointers; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Tests for the pointer factory, and the pointers themselves @@ -50,10 +51,10 @@ public final class TestPointerFactory { -1, 0, 0, 0, -84, -1, 79, 1, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0 }; - @Test(expected = IllegalArgumentException.class) + @Test public void testCreateV4() { PointerFactory pf = new PointerFactory(4); - pf.createPointer(new byte[]{}, 0); + assertThrows(IllegalArgumentException.class, () -> pf.createPointer(new byte[]{}, 0)); } @Test Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java Thu Dec 24 18:42:29 2020 @@ -18,21 +18,21 @@ package org.apache.poi.hdgf.streams; import static org.apache.poi.poifs.storage.RawDataUtil.decompress; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import org.apache.poi.hdgf.pointers.Pointer; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public final class TestStreamBasics extends StreamTest { private static byte[] compressedStream, uncompressedStream; - @BeforeClass + @BeforeAll public static void init() throws IOException { compressedStream = decompress( "H4sIAAAAAAAAAAFTAaz+e8QC6/ABAAC48/BO4PsBAAPr8AoFBOvwFQnr8Gfr8CLc/zQPRg94WA/5/u"+ @@ -43,7 +43,7 @@ public final class TestStreamBasics exte "AA2OvwpEJ/VQFidwAA0E8S/TLvAUNVAVGBANcADgYEET/BEURVvwEeiAAAKk8SRH7r8LRFVQFmiUgl"+ "AGEhwtTYaVMBAAA=" ); - + uncompressedStream = decompress( "H4sIAAAAAAAAAGNgZGDYAcSogJGBGUjCMAsQcwJxOhAroSulEkB2Qqsogw4I41KrMU/BL23vv0cOGn"+ "v7t5eAGU7VnLlgBobUibUb0fVX5HnDrROB0mJA/GW9M2MDkA4BYjcGcSDpc8Of8QqQVgCLgkT2AEV+"+ @@ -53,7 +53,7 @@ public final class TestStreamBasics exte "ROmAgIAAD6SJPAdAIAAA==" ); } - + @Test public void testCompressedStream() { Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java Thu Dec 24 18:42:29 2020 @@ -27,8 +27,8 @@ import org.apache.poi.hdgf.pointers.Poin import org.apache.poi.hdgf.pointers.PointerFactory; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.util.IOUtils; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Tests for bugs with streams @@ -39,7 +39,7 @@ public final class TestStreamBugs extend private PointerFactory ptrFactory; private POIFSFileSystem filesystem; - @Before + @BeforeEach public void setUp() throws IOException { ptrFactory = new PointerFactory(11); chunkFactory = new ChunkFactory(11); Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java Thu Dec 24 18:42:29 2020 @@ -17,11 +17,11 @@ package org.apache.poi.hdgf.streams; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.io.InputStream; @@ -33,8 +33,8 @@ import org.apache.poi.hdgf.pointers.Poin import org.apache.poi.hdgf.pointers.PointerFactory; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.util.IOUtils; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public final class TestStreamComplex extends StreamTest { private byte[] contents; @@ -43,7 +43,7 @@ public final class TestStreamComplex ext private ChunkFactory chunkFactory; private PointerFactory ptrFactory; - @Before + @BeforeEach public void setUp() throws IOException { ptrFactory = new PointerFactory(11); chunkFactory = new ChunkFactory(11); @@ -56,7 +56,7 @@ public final class TestStreamComplex ext InputStream is2 = filesystem.createDocumentInputStream("VisioDocument"); contents = IOUtils.toByteArray(is2); is2.close(); - + filesystem.close(); } Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/TestHemfPlusExtractor.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/TestHemfPlusExtractor.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/TestHemfPlusExtractor.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/TestHemfPlusExtractor.java Thu Dec 24 18:42:29 2020 @@ -18,7 +18,7 @@ package org.apache.poi.hemf.hemfplus.extractor; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.InputStream; import java.util.ArrayList; @@ -32,7 +32,7 @@ import org.apache.poi.hemf.record.emfplu import org.apache.poi.hemf.record.emfplus.HemfPlusRecord; import org.apache.poi.hemf.record.emfplus.HemfPlusRecordType; import org.apache.poi.hemf.usermodel.HemfPicture; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TestHemfPlusExtractor { Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/TestHemfPicture.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/TestHemfPicture.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/TestHemfPicture.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/TestHemfPicture.java Thu Dec 24 18:42:29 2020 @@ -19,9 +19,10 @@ package org.apache.poi.hemf.usermodel; import static org.apache.poi.POITestCase.assertContains; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.awt.geom.Point2D; import java.io.ByteArrayInputStream; @@ -49,7 +50,7 @@ import org.apache.poi.hwmf.usermodel.Hwm import org.apache.poi.hwmf.usermodel.HwmfPicture; import org.apache.poi.util.IOUtils; import org.apache.poi.util.RecordFormatException; -import org.junit.Test; +import org.junit.jupiter.api.Test; @SuppressWarnings("StatementWithEmptyBody") public class TestHemfPicture { @@ -274,27 +275,22 @@ public class TestHemfPicture { } } - @Test(expected = RecordFormatException.class) + @Test public void testInfiniteLoopOnFile() throws Exception { try (InputStream is = ss_samples.openResourceAsStream("61294.emf")) { HemfPicture pic = new HemfPicture(is); - for (HemfRecord ignored : pic) { - - } + assertThrows(RecordFormatException.class, () -> pic.forEach(r -> {})); } } - @Test(expected = RecordFormatException.class) + @Test public void testInfiniteLoopOnByteArray() throws Exception { try (InputStream is = ss_samples.openResourceAsStream("61294.emf")) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); IOUtils.copy(is, bos); - is.close(); HemfPicture pic = new HemfPicture(new ByteArrayInputStream(bos.toByteArray())); - for (HemfRecord ignored : pic) { - - } + assertThrows(RecordFormatException.class, () -> pic.forEach(r -> {})); } } Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestAttachments.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestAttachments.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestAttachments.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestAttachments.java Thu Dec 24 18:42:29 2020 @@ -18,8 +18,8 @@ package org.apache.poi.hmef; import static org.apache.poi.hmef.TestHMEFMessage.openSample; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.IOException; import java.text.DateFormat; @@ -28,13 +28,13 @@ import java.util.List; import java.util.Locale; import org.apache.poi.util.LocaleUtil; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public final class TestAttachments { private static HMEFMessage quick; - @BeforeClass + @BeforeAll public static void setUp() throws IOException { quick = openSample("quick-winmail.dat"); } Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestBugs.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestBugs.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestBugs.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestBugs.java Thu Dec 24 18:42:29 2020 @@ -17,9 +17,9 @@ package org.apache.poi.hmef; import static org.apache.poi.hmef.TestHMEFMessage.openSample; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.util.List; @@ -29,7 +29,7 @@ import org.apache.poi.hmef.attribute.TNE import org.apache.poi.hmef.attribute.TNEFProperty; import org.apache.poi.hsmf.datatypes.MAPIProperty; import org.apache.poi.util.LittleEndian; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TestBugs { @Test Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestCompressedRTF.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestCompressedRTF.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestCompressedRTF.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestCompressedRTF.java Thu Dec 24 18:42:29 2020 @@ -17,10 +17,10 @@ package org.apache.poi.hmef; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -34,7 +34,7 @@ import org.apache.poi.hsmf.datatypes.MAP import org.apache.poi.util.IOUtils; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.StringUtil; -import org.junit.Test; +import org.junit.jupiter.api.Test; public final class TestCompressedRTF { private static final POIDataSamples _samples = POIDataSamples.getHMEFInstance(); Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestHMEFMessage.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestHMEFMessage.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestHMEFMessage.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/TestHMEFMessage.java Thu Dec 24 18:42:29 2020 @@ -17,12 +17,12 @@ package org.apache.poi.hmef; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -40,7 +40,7 @@ import org.apache.poi.hsmf.datatypes.MAP import org.apache.poi.hsmf.datatypes.Types; import org.apache.poi.util.IOUtils; import org.apache.poi.util.LittleEndian; -import org.junit.Test; +import org.junit.jupiter.api.Test; public final class TestHMEFMessage { private static final POIDataSamples _samples = POIDataSamples.getHMEFInstance(); @@ -66,8 +66,8 @@ public final class TestHMEFMessage { int mapiAttrCount = attach.getMAPIAttributes().size(); assertEquals(6, attrCount); - assertTrue("Should be 20-25 mapi attributes, found " + mapiAttrCount, mapiAttrCount >= 20); - assertTrue("Should be 20-25 mapi attributes, found " + mapiAttrCount, mapiAttrCount <= 25); + assertTrue(mapiAttrCount >= 20, "Should be 20-25 mapi attributes, found " + mapiAttrCount); + assertTrue(mapiAttrCount <= 25, "Should be 20-25 mapi attributes, found " + mapiAttrCount); } } Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/attribute/TestMAPIAttributes.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/attribute/TestMAPIAttributes.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/attribute/TestMAPIAttributes.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/attribute/TestMAPIAttributes.java Thu Dec 24 18:42:29 2020 @@ -17,8 +17,8 @@ package org.apache.poi.hmef.attribute; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -31,14 +31,14 @@ import org.apache.poi.hmef.HMEFMessage; import org.apache.poi.hsmf.datatypes.MAPIProperty; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LocaleUtil; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public final class TestMAPIAttributes { private static final POIDataSamples _samples = POIDataSamples.getHMEFInstance(); private HMEFMessage quick; - @Before + @BeforeEach public void setUp() throws Exception { try (InputStream stream = _samples.openResourceAsStream("quick-winmail.dat")) { quick = new HMEFMessage(stream); Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/attribute/TestTNEFAttributes.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/attribute/TestTNEFAttributes.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/attribute/TestTNEFAttributes.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/attribute/TestTNEFAttributes.java Thu Dec 24 18:42:29 2020 @@ -17,8 +17,8 @@ package org.apache.poi.hmef.attribute; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -33,14 +33,14 @@ import org.apache.poi.hmef.HMEFMessage; import org.apache.poi.hsmf.datatypes.MAPIProperty; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LocaleUtil; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public final class TestTNEFAttributes { private static final POIDataSamples _samples = POIDataSamples.getHMEFInstance(); private HMEFMessage quick; - @Before + @BeforeEach public void setUp() throws Exception { try (InputStream is = _samples.openResourceAsStream("quick-winmail.dat")) { quick = new HMEFMessage(is); Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/dev/TestHMEFDumper.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/dev/TestHMEFDumper.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/dev/TestHMEFDumper.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/dev/TestHMEFDumper.java Thu Dec 24 18:42:29 2020 @@ -20,17 +20,20 @@ ==================================================================== */ package org.apache.poi.hmef.dev; + +import static org.junit.jupiter.api.Assertions.assertThrows; + import java.io.File; import java.io.PrintStream; import org.apache.poi.POIDataSamples; import org.apache.poi.util.NullPrintStream; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TestHMEFDumper { - @Test(expected = IllegalArgumentException.class) - public void noArguments() throws Exception { - doMain(); + @Test + public void noArguments() { + assertThrows(IllegalArgumentException.class, TestHMEFDumper::doMain); } @Test Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/extractor/TestHMEFContentsExtractor.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/extractor/TestHMEFContentsExtractor.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/extractor/TestHMEFContentsExtractor.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hmef/extractor/TestHMEFContentsExtractor.java Thu Dec 24 18:42:29 2020 @@ -17,10 +17,10 @@ package org.apache.poi.hmef.extractor; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayOutputStream; import java.io.File; @@ -29,7 +29,7 @@ import java.util.Arrays; import org.apache.poi.POIDataSamples; import org.apache.poi.util.TempFile; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TestHMEFContentsExtractor { @Test @@ -44,16 +44,16 @@ public class TestHMEFContentsExtractor { "message.rtf", // from extractMessageBody "quick.txt", "quick.pdf", "quick.xml", "quick.doc", "quick.html" // from extractAttachments }; - + for (String filename : contents) { File f = new File(outputDirectory, filename); - assertTrue(f + " does not exist", f.exists()); + assertTrue(f.exists(), f + " does not exist"); assertTrue(f.delete()); } String[] list = outputDirectory.list(); assertNotNull(list); - assertEquals( "Had: " + Arrays.toString(list), 0, list.length); + assertEquals( 0, list.length, "Had: " + Arrays.toString(list)); assertTrue(outputDirectory.delete()); } @@ -67,7 +67,7 @@ public class TestHMEFContentsExtractor { assertTrue(out.size() > 0); byte[] expectedMagic = new byte[] { '{', '\\', 'r', 't', 'f' }; byte[] magic = Arrays.copyOf(out.toByteArray(), 5); - assertArrayEquals("RTF magic number", expectedMagic, magic); + assertArrayEquals(expectedMagic, magic, "RTF magic number"); out.close(); } @@ -79,6 +79,6 @@ public class TestHMEFContentsExtractor { File rtf = TempFile.createTempFile("quick-winmail-message-body", ".rtf"); assertTrue(rtf.delete()); extractor.extractMessageBody(rtf); - assertTrue("RTF message body is empty", rtf.length() > 0); + assertTrue(rtf.length() > 0, "RTF message body is empty"); } } Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java Thu Dec 24 18:42:29 2020 @@ -17,15 +17,15 @@ package org.apache.poi.hpbf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.io.InputStream; import org.apache.poi.POIDataSamples; -import org.junit.Test; +import org.junit.jupiter.api.Test; public final class TestHPBFDocument { private static final POIDataSamples _samples = POIDataSamples.getPublisherInstance(); Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TestPublisherTextExtractor.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TestPublisherTextExtractor.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TestPublisherTextExtractor.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TestPublisherTextExtractor.java Thu Dec 24 18:42:29 2020 @@ -18,8 +18,8 @@ package org.apache.poi.hpbf.extractor; import static org.apache.poi.POITestCase.assertEndsWith; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.IOException; import java.io.InputStream; @@ -27,7 +27,7 @@ import java.io.InputStream; import org.apache.poi.POIDataSamples; import org.apache.poi.hpbf.HPBFDocument; import org.apache.poi.poifs.filesystem.POIFSFileSystem; -import org.junit.Test; +import org.junit.jupiter.api.Test; public final class TestPublisherTextExtractor { private static final POIDataSamples _samples = POIDataSamples.getPublisherInstance(); Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java Thu Dec 24 18:42:29 2020 @@ -17,15 +17,15 @@ package org.apache.poi.hpbf.model; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.IOException; import java.io.InputStream; import org.apache.poi.POIDataSamples; import org.apache.poi.hpbf.HPBFDocument; -import org.junit.Test; +import org.junit.jupiter.api.Test; public final class TestEscherParts { private static final POIDataSamples _samples = POIDataSamples.getPublisherInstance(); @@ -51,7 +51,7 @@ public final class TestEscherParts { @Test public void testComplex() throws Exception { - InputStream is = _samples.openResourceAsStream("SampleBrochure.pub"); + InputStream is = _samples.openResourceAsStream("SampleBrochure.pub"); HPBFDocument doc1 = new HPBFDocument(is); is.close(); @@ -68,7 +68,7 @@ public final class TestEscherParts { doc1.close(); // Now do another complex file - InputStream is2 = _samples.openResourceAsStream("SampleNewsletter.pub"); + InputStream is2 = _samples.openResourceAsStream("SampleNewsletter.pub"); HPBFDocument doc2 = new HPBFDocument(is2); is2.close(); Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java Thu Dec 24 18:42:29 2020 @@ -19,10 +19,10 @@ package org.apache.poi.hpbf.model; import static org.apache.poi.POITestCase.assertStartsWith; import static org.apache.poi.POITestCase.assertEndsWith; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; @@ -33,7 +33,7 @@ import org.apache.poi.hpbf.model.qcbits. import org.apache.poi.hpbf.model.qcbits.QCPLCBit.Type4; import org.apache.poi.hpbf.model.qcbits.QCPLCBit.Type8; import org.apache.poi.hpbf.model.qcbits.QCTextBit; -import org.junit.Test; +import org.junit.jupiter.api.Test; public final class TestQuillContents { private static final POIDataSamples _samples = POIDataSamples.getPublisherInstance(); Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java Thu Dec 24 18:42:29 2020 @@ -18,7 +18,8 @@ package org.apache.poi.hslf; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; import java.io.InputStream; @@ -26,7 +27,7 @@ import java.io.InputStream; import org.apache.poi.POIDataSamples; import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException; import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Tests that HSLFSlideShow does the right thing with an encrypted file @@ -43,24 +44,24 @@ public final class TestEncryptedFile { is.close(); } - @Test(expected=EncryptedPowerPointFileException.class) + @Test public void testLoadEncrypted1() throws IOException { try (InputStream is = slTests.openResourceAsStream("Password_Protected-hello.ppt")) { - new HSLFSlideShowImpl(is).close(); + assertThrows(EncryptedPowerPointFileException.class, () -> new HSLFSlideShowImpl(is).close()); } } - - @Test(expected=EncryptedPowerPointFileException.class) + + @Test public void testLoadEncrypted2() throws IOException { try (InputStream is = slTests.openResourceAsStream("Password_Protected-np-hello.ppt")) { - new HSLFSlideShowImpl(is).close(); + assertThrows(EncryptedPowerPointFileException.class, () -> new HSLFSlideShowImpl(is).close()); } } - - @Test(expected=EncryptedPowerPointFileException.class) + + @Test public void testLoadEncrypted3() throws IOException { try (InputStream is = slTests.openResourceAsStream("Password_Protected-56-hello.ppt")) { - new HSLFSlideShowImpl(is).close(); + assertThrows(EncryptedPowerPointFileException.class, () -> new HSLFSlideShowImpl(is).close()); } } } Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestPOIDocumentScratchpad.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestPOIDocumentScratchpad.java?rev=1884783&r1=1884782&r2=1884783&view=diff ============================================================================== --- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestPOIDocumentScratchpad.java (original) +++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestPOIDocumentScratchpad.java Thu Dec 24 18:42:29 2020 @@ -21,8 +21,8 @@ package org.apache.poi.hslf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -36,8 +36,8 @@ import org.apache.poi.hpsf.SummaryInform import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; import org.apache.poi.hwpf.HWPFTestDataSamples; import org.apache.poi.poifs.filesystem.POIFSFileSystem; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Tests that POIDocument correctly loads and saves the common @@ -55,7 +55,7 @@ public final class TestPOIDocumentScratc * Set things up, using a PowerPoint document and * a Word Document for our testing */ - @Before + @BeforeEach public void setUp() throws IOException { doc = new HSLFSlideShowImpl(POIDataSamples.getSlideShowInstance().openResourceAsStream("basic_test_ppt_file.ppt")); doc2 = HWPFTestDataSamples.openSampleFile("test2.doc"); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org