Skip to content

Commit 5b6b020

Browse files
gselzerctrueden
authored andcommitted
Upgrade SciJava Persist to JUnit 5
1 parent 461fadf commit 5b6b020

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

scijava/scijava-persist/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,13 @@
113113

114114
<!--- Test dependencies -->
115115
<dependency>
116-
<groupId>junit</groupId>
117-
<artifactId>junit</artifactId>
116+
<groupId>org.junit.jupiter</groupId>
117+
<artifactId>junit-jupiter-api</artifactId>
118+
<scope>test</scope>
119+
</dependency>
120+
<dependency>
121+
<groupId>org.junit.jupiter</groupId>
122+
<artifactId>junit-jupiter-engine</artifactId>
118123
<scope>test</scope>
119124
</dependency>
120125
</dependencies>

scijava/scijava-persist/src/test/java/org/scijava/persist/SerializationTests.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33

44
import com.google.gson.Gson;
55

6-
import org.junit.After;
7-
import org.junit.Assert;
8-
import org.junit.Before;
9-
import org.junit.Test;
6+
import org.junit.jupiter.api.AfterEach;
7+
import org.junit.jupiter.api.BeforeEach;
8+
import org.junit.jupiter.api.Test;
109
import org.scijava.Context;
1110

11+
import static org.junit.jupiter.api.Assertions.assertEquals;
12+
1213
public class SerializationTests {
1314

1415
static Context context;
@@ -22,7 +23,7 @@ public static void main(String... args) {
2223
gson = ScijavaGsonHelper.getGson(context);
2324
}
2425

25-
@Before
26+
@BeforeEach
2627
public void openFiji() {
2728
// Initializes static SourceService and Display Service and plugins for
2829
// serialization
@@ -33,7 +34,7 @@ public void openFiji() {
3334
gson = ScijavaGsonHelper.getGson(context, true);
3435
}
3536

36-
@After
37+
@AfterEach
3738
public void closeFiji() throws Exception {
3839
context.dispose();
3940
context = null;
@@ -77,6 +78,6 @@ public static void testSerializationDeserialization(Gson gson, Object o,
7778
Object oRestored = gson.fromJson(json, c);
7879
String json2 = gson.toJson(oRestored, c);
7980
System.out.println(json2);
80-
Assert.assertEquals(json, json2);
81+
assertEquals(json, json2);
8182
}
8283
}

0 commit comments

Comments
 (0)