diff --git a/build.gradle b/build.gradle index 94327bfd..79512151 100644 --- a/build.gradle +++ b/build.gradle @@ -125,10 +125,12 @@ class Tags { } } -ext.junit4Version = '4.12' -ext.junitVintageVersion = '4.12.0-M2' -ext.junitPlatformVersion = '1.0.0-M2' -ext.junitJupiterVersion = '5.0.0-M2' +ext { + junit4Version = '4.12' + junitVintageVersion = '4.12.0-M2' + junitPlatformVersion = '1.0.0-M2' + junitJupiterVersion = '5.0.0-M2' +} subprojects { apply plugin: 'com.github.johnrengelman.shadow' @@ -146,7 +148,7 @@ subprojects { } dependencies { - //compile 'junit:junit:4.12' + // compile 'junit:junit:4.12' compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.+' compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.+' // You can also use the JDK's built-in logging as the back end: @@ -159,11 +161,12 @@ subprojects { // If you also want to support JUnit 3 and JUnit 4 tests testCompile("junit:junit:${junit4Version}") testRuntime("org.junit.vintage:junit-vintage-engine:${junitVintageVersion}")*/ + compile "org.junit.jupiter:junit-jupiter-api:5.0.0-M2" testCompile "org.junit.jupiter:junit-jupiter-api:5.0.0-M2" testRuntime "org.junit.jupiter:junit-jupiter-engine:5.0.0-M2" - testCompile "junit:junit:4.12" +/* testCompile "junit:junit:4.12" testRuntime "org.junit.vintage:junit-vintage-engine:4.12.0-M2" -/* compile "org.junit.jupiter:junit-jupiter-api:5.0.0-M2" +*//* compile "org.junit.jupiter:junit-jupiter-api:5.0.0-M2" compile "org.junit.vintage:junit-vintage-engine:4.12.0-M2"*/ } diff --git a/references/DeepCopy.java b/references/DeepCopy.java index 0976d6dc..ba4db549 100644 --- a/references/DeepCopy.java +++ b/references/DeepCopy.java @@ -4,8 +4,8 @@ // Visit http://mindviewinc.com/Books/OnJava/ for more book information. // Cloning a composed object // (Install libraries from junit.org) -import org.junit.Test; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.*; +import static org.junit.jupiter.api.Assertions.*; class DepthReading implements Cloneable { private double depth; diff --git a/verifying/FirstJUnit5Tests.java b/verifying/FirstJUnit5Tests.java index da6546a3..c4ced5d9 100644 --- a/verifying/FirstJUnit5Tests.java +++ b/verifying/FirstJUnit5Tests.java @@ -3,8 +3,8 @@ // We make no guarantees that this code is fit for any purpose. // Visit http://mindviewinc.com/Books/OnJava/ for more book information. package verifying; -import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.*; +import static org.junit.jupiter.api.Assertions.*; class FirstJUnit5Tests { @Test diff --git a/verifying/QueueTest.java b/verifying/QueueTest.java index 5036b7f6..423cd66f 100644 --- a/verifying/QueueTest.java +++ b/verifying/QueueTest.java @@ -4,8 +4,8 @@ // Visit http://mindviewinc.com/Books/OnJava/ for more book information. package verifying; import verifying.Queue; -import org.junit.Test; -import static org.junit.Assert.*; +import org.junit.jupiter.api.*; +import static org.junit.jupiter.api.Assertions.*; public class QueueTest { private Queue queue = new Queue(10); diff --git a/verifying/SimpleJUnit.java b/verifying/SimpleJUnit.java index 7d98eff7..a01aa36e 100644 --- a/verifying/SimpleJUnit.java +++ b/verifying/SimpleJUnit.java @@ -5,8 +5,8 @@ // Simple use of JUnit to test ArrayList package verifying; import java.util.*; -import org.junit.*; -import static org.junit.Assert.*; +import org.junit.jupiter.api.*; +import static org.junit.jupiter.api.Assertions.*; // Keeps track of list objects as they are // created and cleaned up: diff --git a/verifying/StringInverterTest.java b/verifying/StringInverterTest.java index 30c1ebd2..76bd8a6b 100644 --- a/verifying/StringInverterTest.java +++ b/verifying/StringInverterTest.java @@ -4,10 +4,10 @@ // Visit http://mindviewinc.com/Books/OnJava/ for more book information. // {ValidateByHand} // Don't run by itself import java.util.*; -import org.junit.*; -import static org.junit.Assert.*; -import org.junit.runner.*; -import org.junit.runner.notification.Failure; +import org.junit.jupiter.api.*; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.runner.*; +import org.junit.jupiter.runner.notification.Failure; public class StringInverterTest { static StringInverter inverter;