8000 migrate 51 to junit 5 · githubniraj/Leetcode@643827c · GitHub
[go: up one dir, main page]

Skip to content

Commit 643827c

Browse files
migrate 51 to junit 5
1 parent cac6eaf commit 643827c

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed
Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,35 @@
11
package com.fishercoder;
22

33
import com.fishercoder.solutions._51;
4-
import org.junit.Before;
5-
import org.junit.BeforeClass;
64
import org.junit.Test;
5+
import org.junit.jupiter.api.BeforeEach;
76

87
import java.util.ArrayList;
98
import java.util.Arrays;
109
import java.util.List;
1110

12-
import static junit.framework.Assert.assertEquals;
11+
import static org.junit.jupiter.api.Assertions.assertEquals;
1312

1413
public class _51Test {
15-
private static _51.Solution1 solution1;
16-
private static List<List<String>> expected;
17-
private static List<List<String>> actual;
18-
private static int n;
14+
private static _51.Solution1 solution1;
15+
private static List<List<String>> expected;
16+
private static List<List<String>> actual;
17+
private static int n;
1918

20-
@BeforeClass
21-
public static void setup() {
22-
solution1 = new _51.Solution1();
23-
}
19+
@BeforeEach
20+
public void setup() {
21+
solution1 = new _51.Solution1();
22+
expected = new ArrayList<>();
23+
actual = new ArrayList<>();
24+
}
2425

25-
@Before
26-
public void setupForEachTest() {
27-
expected = new ArrayList<>();
28-
actual = new ArrayList<>();
29-
}
30-
31-
@Test
32-
public void test1() {
33-
n = 4;
34-
expected = new ArrayList<>();
35-
expected.add(Arrays.asList("..Q.", "Q...", "...Q", ".Q.."));
36-
expected.add(Arrays.asList(".Q..", "...Q", "Q...", "..Q."));
37-
actual = solution1.solveNQueens(n);
38-
assertEquals(expected, actual);
39-
}
26+
@Test
27+
public void test1() {
28+
n = 4;
29+
expected = new ArrayList<>();
30+
expected.add(Arrays.asList("..Q.", "Q...", "...Q", ".Q.."));
31+
expected.add(Arrays.asList(".Q..", "...Q", "Q...", "..Q."));
32+
actual = solution1.solveNQueens(n);
33+
assertEquals(expected, actual);
34+
}
4035
}

0 commit comments

Comments
 (0)
0