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 5794d43a updated Class2HTMLTestCase with new test input Java4Example
(#186)
5794d43a is described below
commit 5794d43ab3bdee8371c02021e0dd7698cff13aca
Author: nbauma109 <[email protected]>
AuthorDate: Sat Apr 8 01:30:39 2023 +0200
updated Class2HTMLTestCase with new test input Java4Example (#186)
Co-authored-by: nbauma109 <[email protected]>
---
.../java/org/apache/bcel/util/Class2HTMLTestCase.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/test/java/org/apache/bcel/util/Class2HTMLTestCase.java
b/src/test/java/org/apache/bcel/util/Class2HTMLTestCase.java
index e920c747..4f1790a0 100644
--- a/src/test/java/org/apache/bcel/util/Class2HTMLTestCase.java
+++ b/src/test/java/org/apache/bcel/util/Class2HTMLTestCase.java
@@ -25,21 +25,29 @@ import java.io.FileInputStream;
import org.apache.bcel.Constants;
import org.apache.bcel.classfile.ClassParser;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
public class Class2HTMLTestCase {
- @Test
- public void testConvertJavaUtil() throws Exception {
+ @ParameterizedTest
+ @ValueSource(strings = {
+ // @formatter:off
+ "target/test-classes/Java8Example.class",
+ "target/test-classes/Java4Example.class"})
+ // @formatter:on
+ public void testConvertJavaUtil(final String classFileName) throws
Exception {
final File outputDir = new File("target/test-output/html");
if (!outputDir.mkdirs()) { // either was not created or already existed
assertTrue(outputDir.isDirectory()); // fail if missing
}
- try (FileInputStream file = new
FileInputStream("target/test-classes/Java8Example.class")) {
+ try (FileInputStream file = new FileInputStream(classFileName)) {
- final ClassParser parser = new ClassParser(file,
"Java8Example.class");
+ final ClassParser parser = new ClassParser(file, new
File(classFileName).getName());
new Class2HTML(parser.parse(), outputDir.getAbsolutePath() + "/");
+ // TODO assertions on generated HTML code
}
}