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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new aeb9c66f Fix broken tests.
aeb9c66f is described below

commit aeb9c66f3ead671687cf6ef5f5bb1bdcae298d0f
Author: Gary Gregory <[email protected]>
AuthorDate: Thu May 5 14:55:36 2022 -0400

    Fix broken tests.
---
 .../commons/compress/archivers/zip/ZipArchiveEntryTest.java  | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
 
b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
index ff281094..0d825f8a 100644
--- 
a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
+++ 
b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertThrows;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -41,9 +42,6 @@ import org.junit.rules.ExpectedException;
  */
 public class ZipArchiveEntryTest {
 
-    @Rule
-    public final ExpectedException thrown = ExpectedException.none();
-
     /**
      * test handling of extra fields
      */
@@ -307,9 +305,7 @@ public class ZipArchiveEntryTest {
         throws Exception {
         try (ZipFile zf = new ZipFile(getFile("COMPRESS-479.zip"))) {
             final ZipArchiveEntry ze = zf.getEntry("%U20AC_for_Dollar.txt");
-            thrown.expect(ZipException.class);
-            thrown.expectMessage("Unsupported version [116] for UniCode path 
extra data.");
-            
ze.getExtraFields(ZipArchiveEntry.ExtraFieldParsingMode.STRICT_FOR_KNOW_EXTRA_FIELDS);
+            assertThrows(ZipException.class, () -> 
ze.getExtraFields(ZipArchiveEntry.ExtraFieldParsingMode.STRICT_FOR_KNOW_EXTRA_FIELDS));
         }
     }
 
@@ -354,9 +350,7 @@ public class ZipArchiveEntryTest {
         final ZipExtraField[] extraFields = parsingModeBehaviorTestData();
         final ZipArchiveEntry ze = new ZipArchiveEntry("foo");
         ze.setExtraFields(extraFields);
-        thrown.expect(ZipException.class);
-        thrown.expectMessage("Bad extra field starting at");
-        ze.getExtraFields(ZipArchiveEntry.ExtraFieldParsingMode.DRACONIC);
+        assertThrows(ZipException.class, () -> 
ze.getExtraFields(ZipArchiveEntry.ExtraFieldParsingMode.DRACONIC));
     }
 
     private ZipExtraField[] parsingModeBehaviorTestData() {

Reply via email to