Skip to content

Commit 78cd7cf

Browse files
committed
Improved tests
1 parent 6bfd733 commit 78cd7cf

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

src/main/java/g1101_1200/s1117_building_h2o/H2O.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ public HydrogenRunnable(H2O h2O) {
3535
this.h2O = h2O;
3636
}
3737

38+
private static void run2() {}
39+
3840
@Override
3941
public void run() {
4042
try {
41-
h2O.hydrogen(() -> System.out.print('H'));
43+
h2O.hydrogen(HydrogenRunnable::run2);
4244
} catch (InterruptedException ignored) {
4345
// ignored
4446
}
@@ -52,10 +54,12 @@ public OxygenRunnable(H2O h2O) {
5254
this.h2O = h2O;
5355
}
5456

57+
private static void run2() {}
58+
5559
@Override
5660
public void run() {
5761
try {
58-
h2O.oxygen(() -> System.out.print('O'));
62+
h2O.oxygen(OxygenRunnable::run2);
5963
} catch (InterruptedException ignored) {
6064
// ignored
6165
}

src/main/java/g1401_1500/s1489_find_critical_and_pseudo_critical_edges_in_minimum_spanning_tree/Solution.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ public List<List<Integer>> findCriticalAndPseudoCriticalEdges(int n, int[][] edg
4848
pce.addAll(cur);
4949
pce.add(ind);
5050
}
51-
if (!p) {
52-
System.out.println("Should not reach here");
53-
}
5451
}
5552
}
5653
// critical edges

src/test/java/g0401_0500/s0478_generate_random_point_in_a_circle/SolutionTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
import static org.hamcrest.CoreMatchers.equalTo;
44
import static org.hamcrest.MatcherAssert.assertThat;
55

6-
import com_github_leetcode.CommonUtils;
76
import org.junit.jupiter.api.Test;
87

98
class SolutionTest {
109
@Test
1110
void randPoint() {
1211
Solution solution = new Solution(1.0, 0.0, 0.0);
13-
CommonUtils.printArray(solution.randPoint());
14-
CommonUtils.printArray(solution.randPoint());
15-
CommonUtils.printArray(solution.randPoint());
12+
solution.randPoint();
13+
solution.randPoint();
14+
solution.randPoint();
1615
assertThat(solution, equalTo(solution));
1716
}
1817
}

src/test/java/g0401_0500/s0497_random_point_in_non_overlapping_rectangles/SolutionTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
import static org.hamcrest.CoreMatchers.equalTo;
44
import static org.hamcrest.MatcherAssert.assertThat;
55

6-
import com_github_leetcode.CommonUtils;
76
import org.junit.jupiter.api.Test;
87

98
class SolutionTest {
109
@Test
1110
void solutionTest() {
1211
Solution solution = new Solution(new int[][] {{-2, -2, 1, 1}, {2, 2, 4, 6}});
13-
CommonUtils.printArray(solution.pick());
14-
CommonUtils.printArray(solution.pick());
15-
CommonUtils.printArray(solution.pick());
16-
CommonUtils.printArray(solution.pick());
17-
CommonUtils.printArray(solution.pick());
12+
solution.pick();
13+
solution.pick();
14+
solution.pick();
15+
solution.pick();
16+
solution.pick();
1817
assertThat(true, equalTo(true));
1918
}
2019
}

src/test/java/g0501_0600/s0519_random_flip_matrix/SolutionTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
import static org.hamcrest.CoreMatchers.equalTo;
44
import static org.hamcrest.MatcherAssert.assertThat;
55

6-
import com_github_leetcode.CommonUtils;
76
import org.junit.jupiter.api.Test;
87

98
class SolutionTest {
109
@Test
1110
void solutionTest() {
1211
Solution solution = new Solution(3, 1);
13-
CommonUtils.printArray(solution.flip());
14-
CommonUtils.printArray(solution.flip());
15-
CommonUtils.printArray(solution.flip());
12+
solution.flip();
13+
solution.flip();
14+
solution.flip();
1615
solution.reset();
17-
CommonUtils.printArray(solution.flip());
16+
solution.flip();
1817
assertThat(true, equalTo(true));
1918
}
2019
}

0 commit comments

Comments
 (0)