2626/*
2727 * @test
2828 * @summary Testing Classfile Code Adaptation.
29- * @run testng AdaptCodeTest
29+ * @run junit AdaptCodeTest
3030 */
3131
3232import java .lang .constant .ConstantDesc ;
4444import helpers .TestUtil ;
4545import helpers .Transforms ;
4646import jdk .classfile .instruction .ConstantInstruction ;
47- import org .testng .annotations .DataProvider ;
48- import org .testng .annotations .Test ;
47+ import org .junit .jupiter .api .Test ;
48+ import static org .junit .jupiter .api .Assertions .*;
49+ import org .junit .jupiter .params .ParameterizedTest ;
50+ import org .junit .jupiter .params .provider .ValueSource ;
4951
50- import static org .testng .Assert .assertEquals ;
51-
52- @ Test ()
53- public class AdaptCodeTest {
52+ class AdaptCodeTest {
5453
5554 static final String testClassName = "AdaptCodeTest$TestClass" ;
5655 static final Path testClassPath = Paths .get (URI .create (AdaptCodeTest .class .getResource (testClassName + ".class" ).toString ()));
5756 private static final String THIRTEEN = "BlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlah" ;
5857 private static final String SEVEN = "BlahBlahBlahBlahBlahBlahBlah" ;
5958
60- public void testNullAdaptIterator () throws Exception {
59+ @ Test
60+ void testNullAdaptIterator () throws Exception {
6161 ClassModel cm = Classfile .parse (testClassPath );
6262 for (ClassTransform t : Transforms .noops ) {
6363 byte [] newBytes = cm .transform (t );
@@ -69,16 +69,22 @@ public void testNullAdaptIterator() throws Exception {
6969 }
7070 }
7171
72- @ Test (dataProvider = "noExceptionClassfiles" )
73- public void testNullAdaptIterator2 (String path ) throws Exception {
72+ @ ParameterizedTest
73+ @ ValueSource (strings = {
74+ "modules/java.base/java/util/AbstractCollection.class" ,
75+ "modules/java.base/java/util/PriorityQueue.class" ,
76+ "modules/java.base/java/util/ArraysParallelSortHelpers.class"
77+ })
78+ void testNullAdaptIterator2 (String path ) throws Exception {
7479 FileSystem fs = FileSystems .getFileSystem (URI .create ("jrt:/" ));
7580 ClassModel cm = Classfile .parse (fs .getPath (path ));
7681 for (ClassTransform t : Transforms .noops ) {
7782 byte [] newBytes = cm .transform (t );
7883 }
7984 }
8085
81- public void testSevenOfThirteenIterator () throws Exception {
86+ @ Test
87+ void testSevenOfThirteenIterator () throws Exception {
8288 ClassModel cm = Classfile .parse (testClassPath );
8389
8490 var transform = ClassTransform .transformingMethodBodies ((codeB , codeE ) -> {
@@ -103,17 +109,8 @@ public void testSevenOfThirteenIterator() throws Exception {
103109 assertEquals (result , SEVEN );
104110 }
105111
106- @ DataProvider (name = "noExceptionClassfiles" )
107- public Object [][] provide () {
108- return new Object [][] { { "modules/java.base/java/util/AbstractCollection.class" },
109- { "modules/java.base/java/util/PriorityQueue.class" },
110- { "modules/java.base/java/util/ArraysParallelSortHelpers.class" }
111- };
112- }
113-
114-
115-
116- public void testCopy () throws Exception {
112+ @ Test
113+ void testCopy () throws Exception {
117114 ClassModel cm = Classfile .parse (testClassPath );
118115 byte [] newBytes = Classfile .build (cm .thisClass ().asSymbol (), cb -> cm .forEachElement (cb ));
119116// TestUtil.writeClass(newBytes, "TestClass.class");
0 commit comments