Skip to content

Commit 1b1c463

Browse files
committed
Simplified asserts in unit tests.
1 parent 803d663 commit 1b1c463

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ public void combinationSum() {
2323

2424
List<List<Integer>> actual = new Solution().combinationSum(new int[] {2, 3, 6, 7}, 7);
2525

26-
for (int i = 0; i < expected.size(); i++) {
27-
assertThat(actual.get(i).toArray(), equalTo(expected.get(i).toArray()));
28-
}
26+
assertThat(actual, equalTo(expected));
2927
}
3028
}

src/test/java/g0001_0100/s0049_group_anagrams/SolutionTest.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ public void groupAnagrams() {
2020
new Solution()
2121
.groupAnagrams(new String[] {"eat", "tea", "tan", "ate", "nat", "bat"});
2222

23-
for (int i = 0; i < expected.size(); i++) {
24-
for (int j = 0; j < expected.get(i).size(); j++) {
25-
assertThat(actual.get(i).get(j), equalTo(expected.get(i).get(j)));
26-
}
27-
}
23+
assertThat(actual, equalTo(expected));
2824
}
2925
}

src/test/java/g0001_0100/s0051_n_queens/SolutionTest.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ public void solveNQueens() {
1616
expected.add(Arrays.asList(".Q..", "...Q", "Q...", "..Q."));
1717
expected.add(Arrays.asList("..Q.", "Q...", "...Q", ".Q.."));
1818

19-
for (int i = 0; i < expected.size(); i++) {
20-
for (int j = 0; j < expected.get(i).size(); j++) {
21-
assertThat(actual.get(i).get(j), equalTo(expected.get(i).get(j)));
22-
}
23-
}
19+
assertThat(actual, equalTo(expected));
2420
}
2521
}

0 commit comments

Comments
 (0)