Update tests to use ScalaTest 3.0.1

This commit is contained in:
str4d
2016-12-29 18:54:23 +00:00
parent 14ca463499
commit 91007735a1
15 changed files with 51 additions and 23 deletions

View File

@ -455,10 +455,14 @@
<!-- scala paths --> <!-- scala paths -->
<target name="scala.init"> <target name="scala.init">
<property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" /> <property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" />
<property name="scala-xml.jar" value="${scalatest.libs}/scala-xml.jar" />
<property name="scalactic.jar" value="${scalatest.libs}/scalactic.jar" />
<property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" /> <property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" />
<property name="mockito.home" value="${ant.home}/lib" />
<taskdef resource="scala/tools/ant/antlib.xml"> <taskdef resource="scala/tools/ant/antlib.xml">
<classpath> <classpath>
<pathelement location="${scalatest.libs}/scala-compiler.jar" /> <pathelement location="${scalatest.libs}/scala-compiler.jar" />
<pathelement location="${scalatest.libs}/scala-reflect.jar" />
<pathelement location="${scala-library.jar}" /> <pathelement location="${scala-library.jar}" />
</classpath> </classpath>
</taskdef> </taskdef>
@ -475,8 +479,11 @@
<scalac srcdir="./test/scalatest" destdir="./build/obj_scala" deprecation="on" > <scalac srcdir="./test/scalatest" destdir="./build/obj_scala" deprecation="on" >
<classpath> <classpath>
<pathelement location="${scala-library.jar}" /> <pathelement location="${scala-library.jar}" />
<pathelement location="${scalactic.jar}" />
<pathelement location="${scalatest.jar}" /> <pathelement location="${scalatest.jar}" />
<pathelement location="${scalatest.libs}/mockito-all.jar" /> <pathelement location="${mockito.home}/byte-buddy.jar" />
<pathelement location="${mockito.home}/objenesis.jar" />
<pathelement location="${mockito.home}/mockito-core.jar" />
<pathelement location="../../../core/java/build/i2pscalatest.jar" /> <pathelement location="../../../core/java/build/i2pscalatest.jar" />
<pathelement location="../../../router/java/build/routerscalatest.jar" /> <pathelement location="../../../router/java/build/routerscalatest.jar" />
<pathelement location="./build/obj" /> <pathelement location="./build/obj" />
@ -513,6 +520,8 @@
<classpath> <classpath>
<pathelement location="${classpath}" /> <pathelement location="${classpath}" />
<pathelement location="${scala-library.jar}" /> <pathelement location="${scala-library.jar}" />
<pathelement location="${scala-xml.jar}" />
<pathelement location="${scalactic.jar}" />
<pathelement location="${scalatest.jar}" /> <pathelement location="${scalatest.jar}" />
<pathelement location="./build/obj_cobertura" /> <pathelement location="./build/obj_cobertura" />
<pathelement location="./build/obj" /> <pathelement location="./build/obj" />

View File

@ -3,6 +3,7 @@ package net.i2p.router.update
import org.scalatest.FunSpec import org.scalatest.FunSpec
import org.scalatest.mock.MockitoSugar import org.scalatest.mock.MockitoSugar
import net.i2p.app.ClientAppManager;
import net.i2p.router.RouterContext import net.i2p.router.RouterContext
/** /**
@ -11,7 +12,8 @@ import net.i2p.router.RouterContext
class ConsoleUpdateManagerSpec extends FunSpec with UpdateManagerBehaviors with MockitoSugar { class ConsoleUpdateManagerSpec extends FunSpec with UpdateManagerBehaviors with MockitoSugar {
def consoleUpdateManager = { def consoleUpdateManager = {
val mockCtx = mock[RouterContext] val mockCtx = mock[RouterContext]
val cum = new ConsoleUpdateManager(mockCtx) val mockMgr = mock[ClientAppManager]
val cum = new ConsoleUpdateManager(mockCtx, mockMgr, null)
cum cum
} }

View File

@ -90,10 +90,13 @@ javac.version=1.7
# Location of the libraries required for the ScalaTest tests. # Location of the libraries required for the ScalaTest tests.
# Define this in override.properties or pass in on the command line. # Define this in override.properties or pass in on the command line.
# The directory must contain the following library names: # The directory must contain the following library names:
# mockito-all.jar
# scala-compiler.jar # scala-compiler.jar
# scala-library.jar # scala-library.jar
# scala-reflect.jar
# scala-xml.jar
# scalactic.jar
# scalatest.jar # scalatest.jar
# Tested using Scala 2.12.1, scala-xml 1.0.6, and ScalaTest 3.0.1
#scalatest.libs=/PATH/TO/SCALATEST/lib #scalatest.libs=/PATH/TO/SCALATEST/lib
# Location of the junit libraries # Location of the junit libraries
@ -105,12 +108,14 @@ javac.version=1.7
# Defaults to the ant library path if not set # Defaults to the ant library path if not set
# If set, this must point to a directory containing the files # If set, this must point to a directory containing the files
# hamcrest-core.jar, hamcrest-library.jar, and hamcrest-integration.jar # hamcrest-core.jar, hamcrest-library.jar, and hamcrest-integration.jar
# Tested using Hamcrest 1.3
#hamcrest.home= #hamcrest.home=
# Location of the mockito libraries # Location of the mockito libraries
# Defaults to the ant library path if not set # Defaults to the ant library path if not set
# If set, this must point to a directory containing the files # If set, this must point to a directory containing the files
# mockito-core.jar, byte-buddy.jar, objenesis.jar # mockito-core.jar, byte-buddy.jar, objenesis.jar
# Tested using Mockito 2.5.0 which requires byte-buddy 1.5.12 and objenesis 2.4
#mockito.home= #mockito.home=
# Optional properties used in tests to enable additional tools. # Optional properties used in tests to enable additional tools.

View File

@ -141,10 +141,13 @@
<!-- scala paths --> <!-- scala paths -->
<target name="scala.init"> <target name="scala.init">
<property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" /> <property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" />
<property name="scala-xml.jar" value="${scalatest.libs}/scala-xml.jar" />
<property name="scalactic.jar" value="${scalatest.libs}/scalactic.jar" />
<property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" /> <property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" />
<taskdef resource="scala/tools/ant/antlib.xml"> <taskdef resource="scala/tools/ant/antlib.xml">
<classpath> <classpath>
<pathelement location="${scalatest.libs}/scala-compiler.jar" /> <pathelement location="${scalatest.libs}/scala-compiler.jar" />
<pathelement location="${scalatest.libs}/scala-reflect.jar" />
<pathelement location="${scala-library.jar}" /> <pathelement location="${scala-library.jar}" />
</classpath> </classpath>
</taskdef> </taskdef>
@ -158,6 +161,7 @@
<classpath> <classpath>
<pathelement location="${javac.classpath.mod}" /> <pathelement location="${javac.classpath.mod}" />
<pathelement location="${scala-library.jar}" /> <pathelement location="${scala-library.jar}" />
<pathelement location="${scalactic.jar}" />
<pathelement location="${scalatest.jar}" /> <pathelement location="${scalatest.jar}" />
<pathelement location="./build/obj" /> <pathelement location="./build/obj" />
</classpath> </classpath>
@ -264,6 +268,8 @@
<taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask"> <taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask">
<classpath> <classpath>
<pathelement location="${scala-library.jar}" /> <pathelement location="${scala-library.jar}" />
<pathelement location="${scala-xml.jar}" />
<pathelement location="${scalactic.jar}" />
<pathelement location="${scalatest.jar}" /> <pathelement location="${scalatest.jar}" />
<pathelement location="./build/obj_cobertura" /> <pathelement location="./build/obj_cobertura" />
<pathelement location="./build/obj" /> <pathelement location="./build/obj" />

View File

@ -1,12 +1,12 @@
package net.i2p.data package net.i2p.data
import org.scalatest.FunSpec import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers import org.scalatest.Matchers
/** /**
* @author str4d * @author str4d
*/ */
class HashSpec extends FunSpec with ShouldMatchers { class HashSpec extends FunSpec with Matchers {
val hash = new Hash val hash = new Hash
describe("A Hash") { describe("A Hash") {

View File

@ -1,12 +1,12 @@
package net.i2p.data package net.i2p.data
import org.scalatest.FunSpec import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers import org.scalatest.Matchers
/** /**
* @author str4d * @author str4d
*/ */
class PrivateKeySpec extends FunSpec with ShouldMatchers { class PrivateKeySpec extends FunSpec with Matchers {
val privateKey = new PrivateKey val privateKey = new PrivateKey
describe("A PrivateKey") { describe("A PrivateKey") {

View File

@ -1,12 +1,12 @@
package net.i2p.data package net.i2p.data
import org.scalatest.FunSpec import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers import org.scalatest.Matchers
/** /**
* @author str4d * @author str4d
*/ */
class PublicKeySpec extends FunSpec with ShouldMatchers { class PublicKeySpec extends FunSpec with Matchers {
val publicKey = new PublicKey val publicKey = new PublicKey
describe("A PublicKey") { describe("A PublicKey") {

View File

@ -1,12 +1,12 @@
package net.i2p.data package net.i2p.data
import org.scalatest.FunSpec import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers import org.scalatest.Matchers
/** /**
* @author str4d * @author str4d
*/ */
class SessionKeySpec extends FunSpec with ShouldMatchers { class SessionKeySpec extends FunSpec with Matchers {
val sessionKey = new SessionKey val sessionKey = new SessionKey
describe("A SessionKey") { describe("A SessionKey") {

View File

@ -1,12 +1,12 @@
package net.i2p.data package net.i2p.data
import org.scalatest.FunSpec import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers import org.scalatest.Matchers
/** /**
* @author str4d * @author str4d
*/ */
class SessionTagSpec extends FunSpec with ShouldMatchers { class SessionTagSpec extends FunSpec with Matchers {
val sessionTag = new SessionTag val sessionTag = new SessionTag
describe("A SessionTag") { describe("A SessionTag") {

View File

@ -1,12 +1,12 @@
package net.i2p.data package net.i2p.data
import org.scalatest.FunSpec import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers import org.scalatest.Matchers
/** /**
* @author str4d * @author str4d
*/ */
class SignatureSpec extends FunSpec with ShouldMatchers { class SignatureSpec extends FunSpec with Matchers {
val signature = new Signature val signature = new Signature
describe("A Signature") { describe("A Signature") {

View File

@ -1,12 +1,12 @@
package net.i2p.data package net.i2p.data
import org.scalatest.FunSpec import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers import org.scalatest.Matchers
/** /**
* @author str4d * @author str4d
*/ */
class SigningPrivateKeySpec extends FunSpec with ShouldMatchers { class SigningPrivateKeySpec extends FunSpec with Matchers {
val signingPrivateKey = new SigningPrivateKey val signingPrivateKey = new SigningPrivateKey
describe("A SigningPrivateKey") { describe("A SigningPrivateKey") {

View File

@ -1,12 +1,12 @@
package net.i2p.data package net.i2p.data
import org.scalatest.FunSpec import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers import org.scalatest.Matchers
/** /**
* @author str4d * @author str4d
*/ */
class SigningPublicKeySpec extends FunSpec with ShouldMatchers { class SigningPublicKeySpec extends FunSpec with Matchers {
val signingPublicKey = new SigningPublicKey val signingPublicKey = new SigningPublicKey
describe("A SigningPublicKey") { describe("A SigningPublicKey") {

View File

@ -1,12 +1,12 @@
package net.i2p.data package net.i2p.data
import org.scalatest.FunSpec import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers import org.scalatest.Matchers
/** /**
* @author str4d * @author str4d
*/ */
class TunnelIdSpec extends FunSpec with ShouldMatchers { class TunnelIdSpec extends FunSpec with Matchers {
describe("A TunnelId") { describe("A TunnelId") {
it("should be a 4 byte integer") (pending) it("should be a 4 byte integer") (pending)
} }

View File

@ -1,10 +1,10 @@
package net.i2p.util package net.i2p.util
import org.scalatest.FunSpec import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers import org.scalatest.Matchers
class VersionComparatorSpec extends FunSpec with ShouldMatchers { class VersionComparatorSpec extends FunSpec with Matchers {
private val vc = new VersionComparator private val vc = new VersionComparator

View File

@ -116,10 +116,13 @@
<!-- scala paths --> <!-- scala paths -->
<target name="scala.init"> <target name="scala.init">
<property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" /> <property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" />
<property name="scala-xml.jar" value="${scalatest.libs}/scala-xml.jar" />
<property name="scalactic.jar" value="${scalatest.libs}/scalactic.jar" />
<property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" /> <property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" />
<taskdef resource="scala/tools/ant/antlib.xml"> <taskdef resource="scala/tools/ant/antlib.xml">
<classpath> <classpath>
<pathelement location="${scalatest.libs}/scala-compiler.jar" /> <pathelement location="${scalatest.libs}/scala-compiler.jar" />
<pathelement location="${scalatest.libs}/scala-reflect.jar" />
<pathelement location="${scala-library.jar}" /> <pathelement location="${scala-library.jar}" />
</classpath> </classpath>
</taskdef> </taskdef>
@ -140,6 +143,7 @@
<classpath> <classpath>
<pathelement location="${javac.classpath}" /> <pathelement location="${javac.classpath}" />
<pathelement location="${scala-library.jar}" /> <pathelement location="${scala-library.jar}" />
<pathelement location="${scalactic.jar}" />
<pathelement location="${scalatest.jar}" /> <pathelement location="${scalatest.jar}" />
<pathelement location="../../core/java/build/i2pscalatest.jar" /> <pathelement location="../../core/java/build/i2pscalatest.jar" />
<pathelement location="./build/obj" /> <pathelement location="./build/obj" />
@ -222,6 +226,8 @@
<taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask"> <taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask">
<classpath> <classpath>
<pathelement location="${scala-library.jar}" /> <pathelement location="${scala-library.jar}" />
<pathelement location="${scala-xml.jar}" />
<pathelement location="${scalactic.jar}" />
<pathelement location="${scalatest.jar}" /> <pathelement location="${scalatest.jar}" />
<pathelement location="./build/obj_cobertura" /> <pathelement location="./build/obj_cobertura" />
<pathelement location="./build/obj" /> <pathelement location="./build/obj" />