- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolutionTest.java
More file actions
Latest commit
28 lines (23 loc) · 957 Bytes
/
Copy pathSolutionTest.java
File metadata and controls
28 lines (23 loc) · 957 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
packageremove_element;
importorg.junit.jupiter.params.ParameterizedTest;
importorg.junit.jupiter.params.provider.MethodSource;
importjava.util.stream.Stream;
importstaticorg.junit.jupiter.api.Assertions.assertEquals;
classSolutionTest {
privatestaticStream<Object[]> provideRemoveElementTestCases() {
returnStream.of(
newObject[]{newint[]{3, 2, 2, 3}, 3, 2},
newObject[]{newint[]{0, 1, 2, 2, 3, 0, 4, 2}, 2, 5},
newObject[]{newint[]{1}, 1, 0},
newObject[]{newint[]{1}, 2, 1},
newObject[]{newint[]{1, 1, 1, 1, 1}, 1, 0},
newObject[]{newint[]{1, 1, 1, 1, 1}, 2, 5}
);
}
@ParameterizedTest
@MethodSource("provideRemoveElementTestCases")
voidtestRemoveElement(int[] nums, intval, intexpected) {
intresult = Solution.removeElement(nums, val);
assertEquals(expected, result);
}
}