aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/poifs/storage
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/testcases/org/apache/poi/poifs/storage
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/testcases/org/apache/poi/poifs/storage')
-rw-r--r--src/testcases/org/apache/poi/poifs/storage/AllPOIFSStorageTests.java31
-rw-r--r--src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java8
-rw-r--r--src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockReading.java23
3 files changed, 10 insertions, 52 deletions
diff --git a/src/testcases/org/apache/poi/poifs/storage/AllPOIFSStorageTests.java b/src/testcases/org/apache/poi/poifs/storage/AllPOIFSStorageTests.java
deleted file mode 100644
index 7b29d1b09e..0000000000
--- a/src/testcases/org/apache/poi/poifs/storage/AllPOIFSStorageTests.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.poifs.storage;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-/**
- * Tests for org.apache.poi.poifs.storage
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- TestBATBlock.class,
- TestHeaderBlockReading.class
-})
-public class AllPOIFSStorageTests {
-}
diff --git a/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java b/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java
index 10689b2e21..dac1ae1108 100644
--- a/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java
+++ b/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java
@@ -17,9 +17,9 @@
package org.apache.poi.poifs.storage;
-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.assertTrue;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@@ -27,7 +27,7 @@ import java.util.List;
import org.apache.poi.poifs.common.POIFSBigBlockSize;
import org.apache.poi.poifs.common.POIFSConstants;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Class to test BATBlock functionality
diff --git a/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockReading.java b/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockReading.java
index 3234676d17..40cb3bec52 100644
--- a/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockReading.java
+++ b/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockReading.java
@@ -17,14 +17,14 @@
package org.apache.poi.poifs.storage;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Arrays;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Class to test HeaderBlockReader functionality
@@ -58,24 +58,13 @@ public final class TestHeaderBlockReading {
// verify we can't read a short block
byte[] shortblock = Arrays.copyOf(content, 511);
- try {
- new HeaderBlock(new ByteArrayInputStream(shortblock));
- fail("Should have caught IOException reading a short block");
- } catch (IOException ignored) {
-
- // as expected
- }
+ assertThrows(IOException.class, () -> new HeaderBlock(new ByteArrayInputStream(shortblock)));
// try various forms of corruption
for (int index = 0; index < 8; index++) {
content[index] = (byte) (content[index] - 1);
- try {
- new HeaderBlock(new ByteArrayInputStream(content));
- fail("Should have caught IOException corrupting byte " + index);
- } catch (IOException ignored) {
-
- // as expected
- }
+ assertThrows(IOException.class, () -> new HeaderBlock(new ByteArrayInputStream(content)),
+ "Should have caught IOException corrupting byte " + index);
// restore byte value
content[index] = (byte) (content[index] + 1);