You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/11/06 16:52:50 UTC

[GitHub] [commons-bcel] nbauma109 commented on a diff in pull request #165: code coverage and assertions

nbauma109 commented on code in PR #165:
URL: https://github.com/apache/commons-bcel/pull/165#discussion_r1014861436


##########
src/test/java/org/apache/bcel/classfile/ConstantPoolModuleToStringTestCase.java:
##########
@@ -353,19 +400,50 @@ public void visitUnknown(final Unknown obj) {
         "src/test/resources/jpms/java18/commons-io/module-info.class",
         "src/test/resources/jpms/java19-ea/commons-io/module-info.class"})
     // @formatter:on
-    public void test(final String first) throws Exception {
+    void test(final String first) throws Exception {
         try (final InputStream inputStream = Files.newInputStream(Paths.get(first))) {
-            final ClassParser classParser = new ClassParser(inputStream, "module-info.class");
-            final JavaClass javaClass = classParser.parse();
-            final ConstantPool constantPool = javaClass.getConstantPool();
-            final ToStringVisitor visitor = new ToStringVisitor(constantPool);
-            final DescendingVisitor descendingVisitor = new DescendingVisitor(javaClass, visitor);
-            try {
-                javaClass.accept(descendingVisitor);
-            } catch (Exception | Error e) {
-                fail(visitor.toString(), e);
+            test(inputStream);
+        }
+    }
+
+    @Test
+    void test() throws Exception {
+        final Enumeration<URL> moduleURLs = getClass().getClassLoader().getResources("module-info.class");
+        while (moduleURLs.hasMoreElements()) {
+            final URL url = moduleURLs.nextElement();
+            try (InputStream inputStream = url.openStream()) {
+                test(inputStream);
             }
         }
     }
 
+    @ParameterizedTest
+    @ValueSource(strings = {
+    // @formatter:off
+        "org.apache.commons.lang3.function.TriFunction",

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org