Skip to content

Commit 63071c6

Browse files
migrate two tests to Junit5
1 parent d16893f commit 63071c6

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

build.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ repositories {
3232

3333
dependencies {
3434
compile 'com.google.code.gson:gson:2.8.0'
35-
compile 'junit:junit:4.13'
3635
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.0'
36+
37+
// TODO: to remove Junit4 after all tests are migrated to Junit5
38+
compile 'junit:junit:4.13'
3739
testCompile "junit:junit:4.13.1"
3840

3941
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'

src/test/java/com/fishercoder/_1Test.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package com.fishercoder;
22

33
import com.fishercoder.solutions._1;
4-
import org.junit.BeforeClass;
5-
import org.junit.Test;
4+
import org.junit.jupiter.api.BeforeEach;
5+
import org.junit.jupiter.api.Test;
66

7-
import static org.junit.Assert.assertArrayEquals;
7+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
88

99
public class _1Test {
1010
private static _1.Solution1 solution1;
1111
private static int[] nums;
1212

13-
@BeforeClass
14-
public static void setup() {
13+
@BeforeEach
14+
public void setup() {
1515
solution1 = new _1.Solution1();
1616
}
1717

src/test/java/com/fishercoder/_2Test.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
import com.fishercoder.common.classes.ListNode;
44
import com.fishercoder.common.utils.LinkedListUtils;
55
import com.fishercoder.solutions._2;
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

9-
import static org.junit.Assert.assertEquals;
9+
import static org.junit.jupiter.api.Assertions.assertEquals;
1010

1111
public class _2Test {
1212
private static _2.Solution1 solution1;
1313
private static ListNode l1;
1414
private static ListNode l2;
1515
private static ListNode expected;
1616

17-
@BeforeClass
18-
public static void setup() {
17+
@BeforeEach
18+
public void setup() {
1919
solution1 = new _2.Solution1();
2020
}
2121

0 commit comments

Comments
 (0)