-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCloneGraphTest.java
More file actions
28 lines (25 loc) · 967 Bytes
/
CloneGraphTest.java
File metadata and controls
28 lines (25 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import org.example.helpers.graph.Node;
import org.example.problems.clone_graph.Solution;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.stream.Stream;
public class CloneGraphTest {
private static Stream<Arguments> provideCases() {
return Stream.of(
Arguments.of(Node.createFromArray(new int[][]{{2, 4}, {1, 3}, {2, 4}, {1, 3}})),
Arguments.of(Node.createFromArray(new int[][]{{}})),
Arguments.of(Node.createFromArray(new int[][]{}))
);
}
@ParameterizedTest
@MethodSource("provideCases")
public void test(Node node) {
Solution s = new Solution();
Assertions.assertEquals(node, s.cloneGraph(node));
if (node != null) {
Assertions.assertNotSame(node, s.cloneGraph(node));
}
}
}