aboutsummaryrefslogtreecommitdiffstats
path: root/src/scratchpad/testcases/org/apache/poi/hdgf
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2020-12-24 18:42:29 +0000
committerAndreas Beeker <kiwiwings@apache.org>2020-12-24 18:42:29 +0000
commita0fa9e19b1196bc10034f15474d27ce23bf5865a (patch)
tree499c1eb427ebff72f7e447d13dd1de1552df8146 /src/scratchpad/testcases/org/apache/poi/hdgf
parentfb012041e8dd788637e68737199bc313b3e90098 (diff)
downloadpoi-a0fa9e19b1196bc10034f15474d27ce23bf5865a.tar.gz
poi-a0fa9e19b1196bc10034f15474d27ce23bf5865a.zip
#65026 - Migrate tests to Junit 5
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884783 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad/testcases/org/apache/poi/hdgf')
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java14
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java6
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java14
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hdgf/dev/TestVSDDumper.java10
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java6
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java13
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java18
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java6
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java18
9 files changed, 53 insertions, 52 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java b/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java
index e68cace494..8b69548f46 100644
--- a/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java
+++ b/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java
@@ -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();
diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java b/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java
index 0dc7b30aa6..6d70771657 100644
--- a/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java
+++ b/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFLZW.java
@@ -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 = {
diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java b/src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java
index bfcec5d595..a187fadf42 100644
--- a/src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java
+++ b/src/scratchpad/testcases/org/apache/poi/hdgf/chunks/TestChunks.java
@@ -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" +
diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/dev/TestVSDDumper.java b/src/scratchpad/testcases/org/apache/poi/hdgf/dev/TestVSDDumper.java
index 0b3b68bc63..183342cebc 100644
--- a/src/scratchpad/testcases/org/apache/poi/hdgf/dev/TestVSDDumper.java
+++ b/src/scratchpad/testcases/org/apache/poi/hdgf/dev/TestVSDDumper.java
@@ -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);
}
diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java b/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java
index aaa1cb4be8..18b5e16eb9 100644
--- a/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java
+++ b/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java
@@ -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();
diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java b/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java
index 8947533312..0e2972d6dc 100644
--- a/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java
+++ b/src/scratchpad/testcases/org/apache/poi/hdgf/pointers/TestPointerFactory.java
@@ -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
diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java b/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java
index 436286c07e..9e1df7aec7 100644
--- a/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java
+++ b/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBasics.java
@@ -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 extends StreamTest {
"AA2OvwpEJ/VQFidwAA0E8S/TLvAUNVAVGBANcADgYEET/BEURVvwEeiAAAKk8SRH7r8LRFVQFmiUgl"+
"AGEhwtTYaVMBAAA="
);
-
+
uncompressedStream = decompress(
"H4sIAAAAAAAAAGNgZGDYAcSogJGBGUjCMAsQcwJxOhAroSulEkB2Qqsogw4I41KrMU/BL23vv0cOGn"+
"v7t5eAGU7VnLlgBobUibUb0fVX5HnDrROB0mJA/GW9M2MDkA4BYjcGcSDpc8Of8QqQVgCLgkT2AEV+"+
@@ -53,7 +53,7 @@ public final class TestStreamBasics extends StreamTest {
"ROmAgIAAD6SJPAdAIAAA=="
);
}
-
+
@Test
public void testCompressedStream() {
diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java b/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java
index 006021b014..f2a9579f8a 100644
--- a/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java
+++ b/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java
@@ -27,8 +27,8 @@ import org.apache.poi.hdgf.pointers.Pointer;
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 extends StreamTest {
private PointerFactory ptrFactory;
private POIFSFileSystem filesystem;
- @Before
+ @BeforeEach
public void setUp() throws IOException {
ptrFactory = new PointerFactory(11);
chunkFactory = new ChunkFactory(11);
diff --git a/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java b/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java
index c601a06438..19ec45d0cc 100644
--- a/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java
+++ b/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java
@@ -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.Pointer;
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 extends StreamTest {
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 extends StreamTest {
InputStream is2 = filesystem.createDocumentInputStream("VisioDocument");
contents = IOUtils.toByteArray(is2);
is2.close();
-
+
filesystem.close();
}