Skip to content

Commit ba3c4ee

Browse files
committed
Simplified unit test.
1 parent 1b1c463 commit ba3c4ee

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/test/java/g0001_0100/s0039_combination_sum/SolutionTest.java

+4-16
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,14 @@
33
import static org.hamcrest.CoreMatchers.equalTo;
44
import static org.hamcrest.MatcherAssert.assertThat;
55

6-
import java.util.ArrayList;
7-
import java.util.Arrays;
8-
import java.util.List;
6+
import com_github_leetcode.ArrayUtils;
97
import org.junit.Test;
108

119
public class SolutionTest {
1210
@Test
1311
public void combinationSum() {
14-
List<List<Integer>> expected = new ArrayList<>();
15-
16-
List<Integer> sublist1 = new ArrayList<>();
17-
sublist1.add(7);
18-
List<Integer> sublist2 = new ArrayList<>();
19-
sublist2.addAll(Arrays.asList(3, 2, 2));
20-
21-
expected.add(sublist1);
22-
expected.add(sublist2);
23-
24-
List<List<Integer>> actual = new Solution().combinationSum(new int[] {2, 3, 6, 7}, 7);
25-
26-
assertThat(actual, equalTo(expected));
12+
assertThat(
13+
new Solution().combinationSum(new int[] {2, 3, 6, 7}, 7),
14+
equalTo(ArrayUtils.getLists(new int[][] {{7}, {3, 2, 2}})));
2715
}
2816
}

0 commit comments

Comments
 (0)