garydgregory commented on code in PR #165:
URL: https://github.com/apache/commons-bcel/pull/165#discussion_r1014726556
##########
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:
Please comment why these classes and not others, it will help people reading
the code :-)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]