Skip to content

Commit 41b4abe

Browse files
authored
Updated the project to use JUnit 5 instead of JUnit 4 (#185)
1 parent 440b096 commit 41b4abe

File tree

1,116 files changed

+5504
-5508
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,116 files changed

+5504
-5508
lines changed

build.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ dependencies {
3131
compile 'com.google.code.gson:gson:2.8.0'
3232
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.0'
3333

34-
// TODO: to remove Junit4 after all tests are migrated to Junit5
35-
compile 'junit:junit:4.13'
36-
testCompile "junit:junit:4.13.1"
37-
3834
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
3935
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
4036

src/test/java/com/fishercoder/firstthousand/_100Test.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
import com.fishercoder.common.classes.TreeNode;
44
import com.fishercoder.common.utils.TreeUtils;
55
import com.fishercoder.solutions.firstthousand._100;
6-
import org.junit.BeforeClass;
7-
import org.junit.Test;
6+
import org.junit.jupiter.api.BeforeEach;
7+
import org.junit.jupiter.api.Test;
88

99
import java.util.Arrays;
1010

11-
import static org.junit.Assert.assertEquals;
11+
import static org.junit.jupiter.api.Assertions.assertEquals;
1212

1313
public class _100Test {
14-
private static _100.Solution1 solution1;
14+
private _100.Solution1 solution1;
1515
private static TreeNode p;
1616
private static TreeNode q;
1717

18-
@BeforeClass
19-
public static void setup() {
18+
@BeforeEach
19+
public void setup() {
2020
solution1 = new _100.Solution1();
2121
}
2222

src/test/java/com/fishercoder/firstthousand/_101Test.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66

77
import java.util.Arrays;
88

9-
import org.junit.BeforeClass;
10-
import org.junit.Test;
9+
import org.junit.jupiter.api.BeforeEach;
10+
import org.junit.jupiter.api.Test;
1111

12-
import static org.junit.Assert.assertEquals;
12+
import static org.junit.jupiter.api.Assertions.assertEquals;
1313

1414
public class _101Test {
15-
private static _101.Solution1 solution1;
16-
private static _101.Solution2 solution2;
15+
private _101.Solution1 solution1;
16+
private _101.Solution2 solution2;
1717
private static TreeNode root;
1818

19-
@BeforeClass
20-
public static void setup() {
19+
@BeforeEach
20+
public void setup() {
2121
solution1 = new _101.Solution1();
2222
solution2 = new _101.Solution2();
2323
}

src/test/java/com/fishercoder/firstthousand/_102Test.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
import com.fishercoder.common.utils.CommonUtils;
55
import com.fishercoder.common.utils.TreeUtils;
66
import com.fishercoder.solutions.firstthousand._102;
7-
import org.junit.BeforeClass;
8-
import org.junit.Test;
7+
import org.junit.jupiter.api.BeforeEach;
8+
import org.junit.jupiter.api.Test;
99

1010
import java.util.Arrays;
1111

1212
public class _102Test {
13-
private static _102.Solution1 solution1;
13+
private _102.Solution1 solution1;
1414
private static TreeNode treeRoot;
1515

16-
@BeforeClass
17-
public static void setup() {
16+
@BeforeEach
17+
public void setup() {
1818
solution1 = new _102.Solution1();
1919
}
2020

src/test/java/com/fishercoder/firstthousand/_103Test.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
import com.fishercoder.common.utils.CommonUtils;
55
import com.fishercoder.common.utils.TreeUtils;
66
import com.fishercoder.solutions.firstthousand._103;
7-
import org.junit.BeforeClass;
8-
import org.junit.Test;
7+
import org.junit.jupiter.api.BeforeEach;
8+
import org.junit.jupiter.api.Test;
99

1010
import java.util.Arrays;
1111

1212
public class _103Test {
13-
private static _103.Solution1 solution1;
13+
private _103.Solution1 solution1;
1414
private static TreeNode root;
1515

16-
@BeforeClass
17-
public static void setup() {
16+
@BeforeEach
17+
public void setup() {
1818
solution1 = new _103.Solution1();
1919
}
2020

src/test/java/com/fishercoder/firstthousand/_104Test.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66

77
import java.util.Arrays;
88

9-
import org.junit.BeforeClass;
10-
import org.junit.Test;
9+
import org.junit.jupiter.api.BeforeEach;
10+
import org.junit.jupiter.api.Test;
1111

12-
import static org.junit.Assert.assertEquals;
12+
import static org.junit.jupiter.api.Assertions.assertEquals;
1313

1414
public class _104Test {
15-
private static _104.Solution1 solution1;
16-
private static _104.Solution2 solution2;
15+
private _104.Solution1 solution1;
16+
private _104.Solution2 solution2;
1717
private static TreeNode root;
1818

19-
@BeforeClass
20-
public static void setup() {
19+
@BeforeEach
20+
public void setup() {
2121
solution1 = new _104.Solution1();
2222
solution2 = new _104.Solution2();
2323
}

src/test/java/com/fishercoder/firstthousand/_105Test.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66

77
import java.util.Arrays;
88

9-
import org.junit.BeforeClass;
10-
import org.junit.Test;
9+
import org.junit.jupiter.api.BeforeEach;
10+
import org.junit.jupiter.api.Test;
1111

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

1414
public class _105Test {
15-
private static _105.Solution1 solution1;
15+
private _105.Solution1 solution1;
1616
private static TreeNode expected;
1717
private static TreeNode actual;
1818
private static int[] preorder;
1919
private static int[] inorder;
2020

21-
@BeforeClass
22-
public static void setup() {
21+
@BeforeEach
22+
public void setup() {
2323
solution1 = new _105.Solution1();
2424
}
2525

src/test/java/com/fishercoder/firstthousand/_106Test.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
import com.fishercoder.common.classes.TreeNode;
44
import com.fishercoder.common.utils.TreeUtils;
55
import com.fishercoder.solutions.firstthousand._106;
6-
import org.junit.BeforeClass;
7-
import org.junit.Test;
6+
import org.junit.jupiter.api.BeforeEach;
7+
import org.junit.jupiter.api.Test;
88

99
import java.util.Arrays;
1010

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

1313
public class _106Test {
14-
private static _106.Solution1 solution1;
15-
private static _106.Solution2 solution2;
14+
private _106.Solution1 solution1;
15+
private _106.Solution2 solution2;
1616
private static TreeNode expected;
1717
private static TreeNode actual;
1818
private static int[] inorder;
1919
private static int[] postorder;
2020

21-
@BeforeClass
22-
public static void setup() {
21+
@BeforeEach
22+
public void setup() {
2323
solution1 = new _106.Solution1();
2424
solution2 = new _106.Solution2();
2525
}

src/test/java/com/fishercoder/firstthousand/_107Test.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
import com.fishercoder.common.utils.CommonUtils;
55
import com.fishercoder.common.utils.TreeUtils;
66
import com.fishercoder.solutions.firstthousand._107;
7-
import org.junit.BeforeClass;
8-
import org.junit.Test;
7+
import org.junit.jupiter.api.BeforeEach;
8+
import org.junit.jupiter.api.Test;
99

1010
import java.util.Arrays;
1111

1212
public class _107Test {
13-
private static _107.Solution1 solution1;
13+
private _107.Solution1 solution1;
1414
private static TreeNode root;
1515

16-
@BeforeClass
17-
public static void setup() {
16+
@BeforeEach
17+
public void setup() {
1818
solution1 = new _107.Solution1();
1919
}
2020

src/test/java/com/fishercoder/firstthousand/_108Test.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
import com.fishercoder.common.utils.TreeUtils;
44
import com.fishercoder.solutions.firstthousand._108;
5-
import org.junit.BeforeClass;
6-
import org.junit.Test;
5+
import org.junit.jupiter.api.BeforeEach;
6+
import org.junit.jupiter.api.Test;
77

88
public class _108Test {
9-
private static _108.Solution1 solution1;
9+
private _108.Solution1 solution1;
1010
private static int[] nums;
1111

12-
@BeforeClass
13-
public static void setup() {
12+
@BeforeEach
13+
public void setup() {
1414
solution1 = new _108.Solution1();
1515
}
1616

0 commit comments

Comments
 (0)