2929import org .htmlunit .javascript .configuration .ClassConfiguration ;
3030import org .htmlunit .javascript .configuration .ClassConfiguration .ConstantInfo ;
3131import org .htmlunit .javascript .configuration .JavaScriptConfiguration ;
32- import org .htmlunit .junit .BrowserParameterizedRunner ;
33- import org .htmlunit .junit .BrowserParameterizedRunner .Default ;
34- import org .junit .jupiter .api .Test ;
35- import org .junit .runner .RunWith ;
36- import org .junit .runners .Parameterized .Parameter ;
37- import org .junit .runners .Parameterized .Parameters ;
32+ import org .junit .jupiter .params .ParameterizedTest ;
33+ import org .junit .jupiter .params .provider .Arguments ;
34+ import org .junit .jupiter .params .provider .MethodSource ;
3835
3936/**
4037 * Test all {@code constant}s defined in host classes.
4138 *
4239 * @author Ahmed Ashour
4340 * @author Ronald Brill
4441 */
45- @ RunWith (BrowserParameterizedRunner .class )
4642public class HostConstantsTest extends WebDriverTestCase {
4743
4844 /**
4945 * Returns the parameterized data.
5046 * @return the parameterized data
5147 * @throws Exception if an error occurs
5248 */
53- @ Parameters
54- public static Collection <Object []> data () throws Exception {
55- final List <Object []> list = new ArrayList <>();
49+ public static Collection <Arguments > data () throws Exception {
50+ final List <Arguments > list = new ArrayList <>();
5651 final Set <String > strings = TestCaseTest .getAllConfiguredJsClassNames ();
5752 for (final String host : strings ) {
5853 if (!"Audio" .equals (host )) {
59- list .add (new Object [] { host } );
54+ list .add (Arguments . of ( host ) );
6055 }
6156 }
6257 return list ;
6358 }
6459
65- /**
66- * The parent element name.
67- */
68- @ Parameter
69- public String host_ ;
70-
71- /**
72- * The default test.
73- * @throws Exception if an error occurs
74- */
75- @ Test
76- @ Default
77- public void test () throws Exception {
78- setExpectedAlerts (getExpectedString ());
60+ @ ParameterizedTest
61+ @ MethodSource ("data" )
62+ void test (final String host ) throws Exception {
63+ setExpectedAlerts (getExpectedString (host ));
7964
8065 final String html = DOCTYPE_HTML
8166 + "<html><head>\n "
@@ -84,8 +69,8 @@ public void test() throws Exception {
8469 + "function test() {\n "
8570 + " try {\n "
8671 + " var all = [];\n "
87- + " for (var x in " + host_ + ") {\n "
88- + " if (typeof " + host_ + "[x] == 'number') {\n "
72+ + " for (var x in " + host + ") {\n "
73+ + " if (typeof " + host + "[x] == 'number') {\n "
8974 + " all.push(x);\n "
9075 + " }\n "
9176 + " }\n "
@@ -103,7 +88,7 @@ public void test() throws Exception {
10388
10489 + " for (var i in all) {\n "
10590 + " var x = all[i];\n "
106- + " log(x + ':' + " + host_ + "[x]);\n "
91+ + " log(x + ':' + " + host + "[x]);\n "
10792 + " }\n "
10893 + " } catch(e) {}\n "
10994 + "}\n "
@@ -116,11 +101,11 @@ public void test() throws Exception {
116101 loadPageVerifyTextArea2 (html );
117102 }
118103
119- private String [] getExpectedString () throws Exception {
120- if (host_ .endsWith ("Array" ) || "Image" .equals (host_ ) || "Option" .equals (host_ )) {
104+ private String [] getExpectedString (final String host ) throws Exception {
105+ if (host .endsWith ("Array" ) || "Image" .equals (host ) || "Option" .equals (host )) {
121106 return new String [0 ];
122107 }
123- if ("Error" .equals (host_ ) && getBrowserVersion ().hasFeature (JS_ERROR_STACK_TRACE_LIMIT )) {
108+ if ("Error" .equals (host ) && getBrowserVersion ().hasFeature (JS_ERROR_STACK_TRACE_LIMIT )) {
124109 return new String [] {"stackTraceLimit:10" };
125110 }
126111
@@ -131,7 +116,7 @@ private String[] getExpectedString() throws Exception {
131116 }
132117
133118 final List <String > constants = new ArrayList <>();
134- ClassConfiguration classConfig = classConfigurationIndex .get (host_ );
119+ ClassConfiguration classConfig = classConfigurationIndex .get (host );
135120
136121 boolean first = true ;
137122 while (classConfig != null ) {
0 commit comments