Skip to content

Commit 2161792

Browse files
author
Bruce Eckel
committed
moving to Junit 5
1 parent e89d177 commit 2161792

File tree

6 files changed

+22
-19
lines changed

6 files changed

+22
-19
lines changed

build.gradle

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,12 @@ class Tags {
125125
}
126126
}
127127

128-
ext.junit4Version = '4.12'
129-
ext.junitVintageVersion = '4.12.0-M2'
130-
ext.junitPlatformVersion = '1.0.0-M2'
131-
ext.junitJupiterVersion = '5.0.0-M2'
128+
ext {
129+
junit4Version = '4.12'
130+
junitVintageVersion = '4.12.0-M2'
131+
junitPlatformVersion = '1.0.0-M2'
132+
junitJupiterVersion = '5.0.0-M2'
133+
}
132134

133135
subprojects {
134136
apply plugin: 'com.github.johnrengelman.shadow'
@@ -146,7 +148,7 @@ subprojects {
146148
}
147149

148150
dependencies {
149-
//compile 'junit:junit:4.12'
151+
// compile 'junit:junit:4.12'
150152
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.+'
151153
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.+'
152154
// You can also use the JDK's built-in logging as the back end:
@@ -159,11 +161,12 @@ subprojects {
159161
// If you also want to support JUnit 3 and JUnit 4 tests
160162
testCompile("junit:junit:${junit4Version}")
161163
testRuntime("org.junit.vintage:junit-vintage-engine:${junitVintageVersion}")*/
164+
compile "org.junit.jupiter:junit-jupiter-api:5.0.0-M2"
162165
testCompile "org.junit.jupiter:junit-jupiter-api:5.0.0-M2"
163166
testRuntime "org.junit.jupiter:junit-jupiter-engine:5.0.0-M2"
164-
testCompile "junit:junit:4.12"
167+
/* testCompile "junit:junit:4.12"
165168
testRuntime "org.junit.vintage:junit-vintage-engine:4.12.0-M2"
166-
/* compile "org.junit.jupiter:junit-jupiter-api:5.0.0-M2"
169+
*//* compile "org.junit.jupiter:junit-jupiter-api:5.0.0-M2"
167170
compile "org.junit.vintage:junit-vintage-engine:4.12.0-M2"*/
168171
}
169172

references/DeepCopy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Cloning a composed object
66
// (Install libraries from junit.org)
7-
import org.junit.Test;
8-
import static org.junit.Assert.assertEquals;
7+
import org.junit.jupiter.api.*;
8+
import static org.junit.jupiter.api.Assertions.*;
99

1010
class DepthReading implements Cloneable {
1111
private double depth;

verifying/FirstJUnit5Tests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
package verifying;
6-
import static org.junit.jupiter.api.Assertions.assertEquals;
7-
import org.junit.jupiter.api.Test;
6+
import org.junit.jupiter.api.*;
7+
import static org.junit.jupiter.api.Assertions.*;
88

99
class FirstJUnit5Tests {
1010
@Test

verifying/QueueTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
package verifying;
66
import verifying.Queue;
7-
import org.junit.Test;
8-
import static org.junit.Assert.*;
7+
import org.junit.jupiter.api.*;
8+
import static org.junit.jupiter.api.Assertions.*;
99

1010
public class QueueTest {
1111
private Queue queue = new Queue(10);

verifying/SimpleJUnit.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Simple use of JUnit to test ArrayList
66
package verifying;
77
import java.util.*;
8-
import org.junit.*;
9-
import static org.junit.Assert.*;
8+
import org.junit.jupiter.api.*;
9+
import static org.junit.jupiter.api.Assertions.*;
1010

1111
// Keeps track of list objects as they are
1212
// created and cleaned up:

verifying/StringInverterTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// {ValidateByHand} // Don't run by itself
66
import java.util.*;
7-
import org.junit.*;
8-
import static org.junit.Assert.*;
9-
import org.junit.runner.*;
10-
import org.junit.runner.notification.Failure;
7+
import org.junit.jupiter.api.*;
8+
import static org.junit.jupiter.api.Assertions.*;
9+
import org.junit.jupiter.runner.*;
10+
import org.junit.jupiter.runner.notification.Failure;
1111

1212
public class StringInverterTest {
1313
static StringInverter inverter;

0 commit comments

Comments
 (0)