Skip to content

Commit 1d6ea41

Browse files
committed
updated junit to junit 5
1 parent d68c547 commit 1d6ea41

8 files changed

Lines changed: 54 additions & 164 deletions

File tree

tda/dependency-reduced-pom.xml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,24 @@
8484
</build>
8585
<dependencies>
8686
<dependency>
87-
<groupId>junit</groupId>
88-
<artifactId>junit</artifactId>
89-
<version>4.13.2</version>
90-
<scope>test</scope>
91-
</dependency>
92-
<dependency>
93-
<groupId>org.hamcrest</groupId>
94-
<artifactId>hamcrest-core</artifactId>
95-
<version>1.3</version>
87+
<groupId>org.junit.jupiter</groupId>
88+
<artifactId>junit-jupiter</artifactId>
89+
<version>5.10.1</version>
9690
<scope>test</scope>
91+
<exclusions>
92+
<exclusion>
93+
<artifactId>junit-jupiter-api</artifactId>
94+
<groupId>org.junit.jupiter</groupId>
95+
</exclusion>
96+
<exclusion>
97+
<artifactId>junit-jupiter-params</artifactId>
98+
<groupId>org.junit.jupiter</groupId>
99+
</exclusion>
100+
<exclusion>
101+
<artifactId>junit-jupiter-engine</artifactId>
102+
<groupId>org.junit.jupiter</groupId>
103+
</exclusion>
104+
</exclusions>
97105
</dependency>
98106
</dependencies>
99107
<properties>

tda/pom.xml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,9 @@
3737
<version>2.10.1</version>
3838
</dependency>
3939
<dependency>
40-
<groupId>junit</groupId>
41-
<artifactId>junit</artifactId>
42-
<version>4.13.2</version>
43-
<scope>test</scope>
44-
</dependency>
45-
<dependency>
46-
<groupId>org.hamcrest</groupId>
47-
<artifactId>hamcrest-core</artifactId>
48-
<version>1.3</version>
40+
<groupId>org.junit.jupiter</groupId>
41+
<artifactId>junit-jupiter</artifactId>
42+
<version>5.10.1</version>
4943
<scope>test</scope>
5044
</dependency>
5145
</dependencies>

tda/src/test/java/RootSuite.java

Lines changed: 0 additions & 49 deletions
This file was deleted.

tda/src/test/java/de/grimmfrost/tda/BeaJDKParserTest.java

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,37 +26,27 @@
2626
import java.util.HashMap;
2727
import java.util.Map;
2828
import java.util.Vector;
29-
import junit.framework.Test;
30-
import junit.framework.TestCase;
31-
import junit.framework.TestSuite;
29+
import org.junit.jupiter.api.*;
30+
import static org.junit.jupiter.api.Assertions.*;
3231

3332
/**
3433
*
3534
* @author irockel
3635
*/
37-
public class BeaJDKParserTest extends TestCase {
36+
public class BeaJDKParserTest {
3837

39-
public BeaJDKParserTest(String testName) {
40-
super(testName);
41-
}
42-
38+
@BeforeEach
4339
protected void setUp() throws Exception {
44-
super.setUp();
4540
}
4641

42+
@AfterEach
4743
protected void tearDown() throws Exception {
48-
super.tearDown();
49-
}
50-
51-
public static Test suite() {
52-
TestSuite suite = new TestSuite(BeaJDKParserTest.class);
53-
54-
return suite;
5544
}
5645

5746
/**
5847
* Test of hasMoreDumps method, of class de.grimmfrost.tda.SunJDKParser.
5948
*/
49+
@Test
6050
public void testDumpLoad() throws FileNotFoundException, IOException {
6151
System.out.println("dumpLoad");
6252
FileInputStream fis = null;

tda/src/test/java/de/grimmfrost/tda/DumpParserFactoryTest.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,29 @@
2323

2424
import java.io.FileInputStream;
2525
import java.io.FileNotFoundException;
26-
import junit.framework.*;
26+
import org.junit.jupiter.api.*;
27+
import static org.junit.jupiter.api.Assertions.*;
2728
import java.io.InputStream;
2829
import java.util.Map;
2930

3031
/**
3132
*
3233
* @author irockel
3334
*/
34-
public class DumpParserFactoryTest extends TestCase {
35+
public class DumpParserFactoryTest {
3536

36-
public DumpParserFactoryTest(String testName) {
37-
super(testName);
38-
}
39-
37+
@BeforeEach
4038
protected void setUp() throws Exception {
4139
}
4240

41+
@AfterEach
4342
protected void tearDown() throws Exception {
4443
}
4544

46-
public static Test suite() {
47-
TestSuite suite = new TestSuite(DumpParserFactoryTest.class);
48-
49-
return suite;
50-
}
51-
5245
/**
5346
* Test of get method, of class de.grimmfrost.tda.DumpParserFactory.
5447
*/
48+
@Test
5549
public void testGet() {
5650
System.out.println("get");
5751

@@ -62,6 +56,7 @@ public void testGet() {
6256
/**
6357
* Test of getDumpParserForVersion method, of class de.grimmfrost.tda.DumpParserFactory.
6458
*/
59+
@Test
6560
public void testGetDumpParserForSunLogfile() throws FileNotFoundException {
6661
System.out.println("getDumpParserForVersion");
6762

@@ -78,6 +73,7 @@ public void testGetDumpParserForSunLogfile() throws FileNotFoundException {
7873
/**
7974
* Test of getDumpParserForVersion method, of class de.grimmfrost.tda.DumpParserFactory.
8075
*/
76+
@Test
8177
public void testGetDumpParserForBeaLogfile() throws FileNotFoundException {
8278
System.out.println("getDumpParserForVersion");
8379

tda/src/test/java/de/grimmfrost/tda/SunJDKParserTest.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,29 @@
2828
import javax.swing.tree.DefaultMutableTreeNode;
2929
import javax.swing.tree.MutableTreeNode;
3030
import javax.swing.tree.TreePath;
31-
import junit.framework.*;
31+
import org.junit.jupiter.api.*;
32+
import static org.junit.jupiter.api.Assertions.*;
3233
import java.util.Map;
3334
import java.util.Vector;
3435

3536
/**
3637
* test parsing of log files from sun vms.
3738
* @author irockel
3839
*/
39-
public class SunJDKParserTest extends TestCase {
40+
public class SunJDKParserTest {
4041

41-
public SunJDKParserTest(String testName) {
42-
super(testName);
43-
}
44-
42+
@BeforeEach
4543
protected void setUp() throws Exception {
4644
}
4745

46+
@AfterEach
4847
protected void tearDown() throws Exception {
4948
}
5049

51-
public static Test suite() {
52-
TestSuite suite = new TestSuite(SunJDKParserTest.class);
53-
54-
return suite;
55-
}
56-
5750
/**
5851
* Test of hasMoreDumps method, of class de.grimmfrost.tda.SunJDKParser.
5952
*/
53+
@Test
6054
public void testDumpLoad() throws FileNotFoundException, IOException {
6155
System.out.println("dumpLoad");
6256
FileInputStream fis = null;
@@ -89,6 +83,7 @@ public void testDumpLoad() throws FileNotFoundException, IOException {
8983
/**
9084
* Test of isFoundClassHistograms method, of class de.grimmfrost.tda.SunJDKParser.
9185
*/
86+
@Test
9287
public void testIsFoundClassHistograms() throws FileNotFoundException, IOException {
9388
System.out.println("isFoundClassHistograms");
9489
DumpParser instance = null;
@@ -116,6 +111,7 @@ public void testIsFoundClassHistograms() throws FileNotFoundException, IOExcepti
116111
}
117112
}
118113

114+
@Test
119115
public void test64BitDumpLoad() throws FileNotFoundException, IOException {
120116
System.out.println("64BitDumpLoad");
121117
FileInputStream fis = null;
@@ -145,6 +141,7 @@ public void test64BitDumpLoad() throws FileNotFoundException, IOException {
145141
}
146142
}
147143

144+
@Test
148145
public void testJava8DumpLoad() throws FileNotFoundException, IOException {
149146
System.out.println("Java8DumpLoad");
150147
FileInputStream fis = null;
@@ -174,6 +171,7 @@ public void testJava8DumpLoad() throws FileNotFoundException, IOException {
174171
}
175172
}
176173

174+
@Test
177175
public void testJava11DumpLoad() throws FileNotFoundException, IOException {
178176
System.out.println("Java11DumpLoad");
179177
FileInputStream fis = null;
@@ -203,6 +201,7 @@ public void testJava11DumpLoad() throws FileNotFoundException, IOException {
203201
}
204202
}
205203

204+
@Test
206205
public void testHPDumps() throws FileNotFoundException, IOException {
207206
System.out.println("HPDumpLoad");
208207
FileInputStream fis = null;
@@ -232,6 +231,7 @@ public void testHPDumps() throws FileNotFoundException, IOException {
232231
}
233232
}
234233

234+
@Test
235235
public void testRemoteVisualVMDumps() throws FileNotFoundException, IOException {
236236
System.out.println("VisualVMDumpLoad");
237237
FileInputStream fis = null;
@@ -261,6 +261,7 @@ public void testRemoteVisualVMDumps() throws FileNotFoundException, IOException
261261
}
262262
}
263263

264+
@Test
264265
public void testURLThreadNameDumps() throws FileNotFoundException, IOException {
265266
System.out.println("URLThreadNameDumpLoad");
266267
FileInputStream fis = null;
@@ -290,6 +291,7 @@ public void testURLThreadNameDumps() throws FileNotFoundException, IOException
290291
}
291292
}
292293

294+
@Test
293295
public void testVirtualThreadDumps() throws FileNotFoundException, IOException {
294296
System.out.println("VirtualThreadDumpLoad");
295297
FileInputStream fis = null;
@@ -319,6 +321,7 @@ public void testVirtualThreadDumps() throws FileNotFoundException, IOException {
319321
}
320322
}
321323

324+
@Test
322325
public void testLongRunningDetectionWithVariableFields() throws FileNotFoundException, IOException {
323326
System.out.println("testLongRunningDetectionWithVariableFields");
324327
FileInputStream fis = null;
@@ -364,11 +367,11 @@ public void testLongRunningDetectionWithVariableFields() throws FileNotFoundExce
364367
instance.findLongRunningThreads(root, dumpMap, paths, 2, null);
365368

366369
// Check if long running threads were found
367-
assertTrue("Should have children", root.getChildCount() > 0);
370+
assertTrue(root.getChildCount() > 0, "Should have children");
368371
DefaultMutableTreeNode resultNode = (DefaultMutableTreeNode) root.getChildAt(0);
369372

370373
// We expect at least 2 long running threads ("C2 CompilerThread0" and "VM Periodic Task Thread")
371-
assertTrue("Should find at least one long running thread, found: " + resultNode.getChildCount(), resultNode.getChildCount() > 0);
374+
assertTrue(resultNode.getChildCount() > 0, "Should find at least one long running thread, found: " + resultNode.getChildCount());
372375

373376
} finally {
374377
if(instance != null) {

tda/src/test/java/de/grimmfrost/tda/TdaSuite.java

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)