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-bcel.git


The following commit(s) were added to refs/heads/master by this push:
     new 217b0fc9 Clean up exception handling in unit test
217b0fc9 is described below

commit 217b0fc9da62fd8e98287adeb0bf44a4549956be
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Jan 4 17:24:37 2026 -0500

    Clean up exception handling in unit test
    
    assertDoesNotThrow not needed
---
 src/test/java/org/apache/bcel/classfile/JDKClassDumpTest.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/test/java/org/apache/bcel/classfile/JDKClassDumpTest.java 
b/src/test/java/org/apache/bcel/classfile/JDKClassDumpTest.java
index e8bbecf2..35d71039 100644
--- a/src/test/java/org/apache/bcel/classfile/JDKClassDumpTest.java
+++ b/src/test/java/org/apache/bcel/classfile/JDKClassDumpTest.java
@@ -19,12 +19,12 @@
 
 package org.apache.bcel.classfile;
 
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Path;
 import java.util.Enumeration;
@@ -32,6 +32,7 @@ import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
 import org.apache.bcel.generic.JavaHome;
+import org.apache.commons.io.function.IOStream;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.MethodSource;
@@ -41,7 +42,7 @@ import org.junit.jupiter.params.provider.MethodSource;
  */
 class JDKClassDumpTest {
 
-    private void compare(final JavaClass jc, final InputStream inputStream, 
final String name) throws Exception {
+    private void compare(final JavaClass jc, final InputStream inputStream, 
final String name) throws IOException {
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
         try (DataOutputStream dos = new DataOutputStream(baos)) {
             jc.dump(dos);
@@ -57,7 +58,7 @@ class JDKClassDumpTest {
         }
     }
 
-    private void testJar(final Path path) throws Exception {
+    private void testJar(final Path path) throws IOException {
         try (JarFile jar = new JarFile(path.toFile())) {
             System.out.println("Parsing " + jar.getName());
             final Enumeration<JarEntry> en = jar.entries();
@@ -78,11 +79,11 @@ class JDKClassDumpTest {
     @ParameterizedTest
     @MethodSource("org.apache.bcel.generic.JavaHome#streamJarPath")
     void testPerformance(final Path path) throws Exception {
-        assertDoesNotThrow(() -> testJar(path));
+        testJar(path);
     }
 
     @Test
     void testPerformanceJmod() throws Exception {
-        JavaHome.streamModulePath().forEach(path -> assertDoesNotThrow(() -> 
testJar(path)));
+        IOStream.adapt(JavaHome.streamModulePath()).forEach(this::testJar);
     }
 }

Reply via email to