Skip to content

Commit c2f9ec5

Browse files
committed
working on junit5 update / WebDriverTestCases (wip)
1 parent 3a556f9 commit c2f9ec5

16 files changed

+1839
-9424
lines changed

src/test/java/org/htmlunit/general/huge/ElementClosesElementTest.java

Lines changed: 204 additions & 999 deletions
Large diffs are not rendered by default.

src/test/java/org/htmlunit/general/huge/HostParentOf.java

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222

2323
import org.htmlunit.TestCaseTest;
2424
import org.htmlunit.WebDriverTestCase;
25-
import org.htmlunit.junit.BrowserParameterizedRunner.Default;
2625
import org.htmlunit.junit.annotation.Alerts;
27-
import org.junit.After;
28-
import org.junit.jupiter.api.Test;
29-
import org.junit.runners.Parameterized.Parameter;
26+
import org.junit.jupiter.params.ParameterizedTest;
27+
import org.junit.jupiter.params.provider.Arguments;
28+
import org.junit.jupiter.params.provider.MethodSource;
3029
import org.openqa.selenium.WebDriver;
3130

3231
/**
@@ -45,50 +44,30 @@ public abstract class HostParentOf extends WebDriverTestCase {
4544
* @return the parameterized data
4645
* @throws Exception if an error occurs
4746
*/
48-
protected static Collection<Object[]> data(final Predicate<String> predicate) throws Exception {
47+
protected static Collection<Arguments> data(final Predicate<String> predicate) throws Exception {
4948
final Set<String> jsClassNames = TestCaseTest.getAllConfiguredJsConstructorNames();
5049

51-
final List<Object[]> list = new ArrayList<>(jsClassNames.size() * jsClassNames.size() / 10);
50+
final List<Arguments> list = new ArrayList<>(jsClassNames.size() * jsClassNames.size() / 10);
5251
for (final String parent : jsClassNames) {
5352
if (predicate.test(parent)) {
5453
for (final String child : jsClassNames) {
55-
list.add(new Object[] {parent, child});
54+
list.add(Arguments.of(parent, child));
5655
}
5756
}
5857
}
5958
return list;
6059
}
6160

62-
/**
63-
* The parent element name.
64-
*/
65-
@Parameter
66-
public String parent_;
67-
68-
/**
69-
* The child element name.
70-
*/
71-
@Parameter(1)
72-
public String child_;
73-
74-
/**
75-
* The default test.
76-
* @throws Exception if an error occurs
77-
*/
78-
@Test
79-
@Alerts("false/false")
80-
@Default
81-
public void isParentOf() throws Exception {
82-
test(parent_, child_);
83-
}
84-
8561
/**
8662
* Runs the test.
8763
*
8864
* @param parent the parent host name
8965
* @param child the child host name
9066
* @throws Exception if an error occurs
9167
*/
68+
@ParameterizedTest(name = "_{0}_{1}")
69+
@MethodSource("data")
70+
@Alerts("false/false")
9271
protected void test(final String parent, final String child) throws Exception {
9372
final String html = DOCTYPE_HTML
9473
+ "<html>\n"
@@ -127,13 +106,4 @@ protected void test(final String parent, final String child) throws Exception {
127106
protected boolean isWebClientCached() {
128107
return true;
129108
}
130-
131-
/**
132-
* Cleanup.
133-
*/
134-
@After
135-
public void after() {
136-
parent_ = null;
137-
child_ = null;
138-
}
139109
}

0 commit comments

Comments
 (0)