- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolutionTest.java
More file actions
Latest commit
25 lines (20 loc) · 786 Bytes
/
Copy pathSolutionTest.java
File metadata and controls
25 lines (20 loc) · 786 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
packagetwo_sum;
importorg.junit.jupiter.api.Assertions;
importorg.junit.jupiter.params.ParameterizedTest;
importorg.junit.jupiter.params.provider.MethodSource;
importjava.util.stream.Stream;
classSolutionTest {
privatestaticStream<Object[]> provideTwoSumTestCases() {
returnStream.of(
newObject[]{newint[]{2, 7, 11, 15}, 9, newint[]{0, 1}},
newObject[]{newint[]{3, 2, 4}, 6, newint[]{1, 2}},
newObject[]{newint[]{3, 3}, 6, newint[]{0, 1}}
);
}
@ParameterizedTest
@MethodSource("provideTwoSumTestCases")
voidtwoSumTest(int[] nums, inttarget, int[] expected) {
int[] result = Solution.twoSum(nums, target);
Assertions.assertArrayEquals(expected, result);
}
}