- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaximumDepthOfBinaryTreeTest.java
More file actions
Latest commit
23 lines (21 loc) · 879 Bytes
/
Copy pathMaximumDepthOfBinaryTreeTest.java
File metadata and controls
23 lines (21 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
importorg.example.helpers.TreeNode;
importorg.example.problems.maximum_depth_of_binary_tree.Solution;
importorg.junit.jupiter.api.Assertions;
importorg.junit.jupiter.params.ParameterizedTest;
importorg.junit.jupiter.params.provider.Arguments;
importorg.junit.jupiter.params.provider.MethodSource;
importjava.util.stream.Stream;
publicclassMaximumDepthOfBinaryTreeTest {
privatestaticStream<Arguments> provideCases() {
returnStream.of(
Arguments.of(newTreeNode(3, newTreeNode(9), newTreeNode(20, newTreeNode(15), newTreeNode(7))), 3),
Arguments.of(newTreeNode(1, null, newTreeNode(2)), 2)
);
}
@ParameterizedTest
@MethodSource("provideCases")
publicvoidtest(TreeNodesource, intexpected) {
Solutions = newSolution();
Assertions.assertSame(expected, s.maxDepth(source));
}
}