Skip to content

Commit d0d45c9

Browse files
committed
BAEL-900 Guide to Dynamic Tests in Junit 5
1 parent f5a0baa commit d0d45c9

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎junit5/src/test/java/com/baeldung/DynamicTestsExample.java‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.baeldung;
22

3-
import static org.junit.jupiter.api.Assertions.assertTrue;
43
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
55

66
import java.util.ArrayList;
77
import java.util.Arrays;
@@ -17,6 +17,8 @@
1717
import org.junit.jupiter.api.DynamicTest;
1818
import org.junit.jupiter.api.TestFactory;
1919
import org.junit.jupiter.api.function.ThrowingConsumer;
20+
import org.junit.platform.runner.JUnitPlatform;
21+
import org.junit.runner.RunWith;
2022

2123
public class DynamicTestsExample {
2224

@@ -100,9 +102,9 @@ Stream<DynamicTest> dynamicTestsFromStreamInJava8() {
100102
DomainNameResolver resolver = new DomainNameResolver();
101103

102104
List<String> inputList =
103-
new ArrayList<>(Arrays.asList("www.somedomain.com", "www.anotherdomain.com", "www.yetanotherdomain.com"));
105+
Arrays.asList("www.somedomain.com", "www.anotherdomain.com", "www.yetanotherdomain.com");
104106
List<String> outputList =
105-
new ArrayList<>(Arrays.asList("154.174.10.56", "211.152.104.132", "178.144.120.156"));
107+
Arrays.asList("154.174.10.56", "211.152.104.132", "178.144.120.156");
106108

107109
return inputList.stream().map(dom -> DynamicTest.dynamicTest("Resolving: " + dom, () -> {
108110
int id = inputList.indexOf(dom);

0 commit comments

Comments
 (0)