1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.bcel.util;
19
20 import static org.junit.jupiter.api.Assertions.assertTrue;
21
22 import java.io.File;
23 import java.io.FileInputStream;
24
25 import org.apache.bcel.Constants;
26 import org.apache.bcel.classfile.ClassParser;
27 import org.junit.jupiter.api.Test;
28 import org.junit.jupiter.params.ParameterizedTest;
29 import org.junit.jupiter.params.provider.ValueSource;
30
31 public class Class2HTMLTestCase {
32
33 @ParameterizedTest
34 @ValueSource(strings = {
35
36 "target/test-classes/Java8Example.class",
37 "target/test-classes/Java4Example.class"})
38
39 public void testConvertJavaUtil(final String classFileName) throws Exception {
40 final File outputDir = new File("target/test-output/html");
41 if (!outputDir.mkdirs()) {
42 assertTrue(outputDir.isDirectory());
43 }
44
45 try (FileInputStream file = new FileInputStream(classFileName)) {
46
47 final ClassParser parser = new ClassParser(file, new File(classFileName).getName());
48
49 new Class2HTML(parser.parse(), outputDir.getAbsolutePath() + "/");
50
51 }
52 }
53
54
55
56
57 @Test
58 public void testReferenceToConstant() {
59 @SuppressWarnings("unused")
60 final short referenceToConstant = Constants.AALOAD;
61 }
62
63 }