|
1 | 1 | package com.fishercoder;
|
2 | 2 |
|
3 | 3 | import com.fishercoder.solutions._51;
|
4 |
| -import org.junit.Before; |
5 |
| -import org.junit.BeforeClass; |
6 | 4 | import org.junit.Test;
|
| 5 | +import org.junit.jupiter.api.BeforeEach; |
7 | 6 |
|
8 | 7 | import java.util.ArrayList;
|
9 | 8 | import java.util.Arrays;
|
10 | 9 | import java.util.List;
|
11 | 10 |
|
12 |
| -import static junit.framework.Assert.assertEquals; |
| 11 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
13 | 12 |
|
14 | 13 | 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; |
19 | 18 |
|
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 | + } |
24 | 25 |
|
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 | + } |
40 | 35 | }
|
0 commit comments