diff --git a/core-test/src/test/scala/org/bitcoins/core/crypto/ECPublicKeyTest.scala b/core-test/src/test/scala/org/bitcoins/core/crypto/ECPublicKeyTest.scala index 5126378ee5..4187fc4809 100644 --- a/core-test/src/test/scala/org/bitcoins/core/crypto/ECPublicKeyTest.scala +++ b/core-test/src/test/scala/org/bitcoins/core/crypto/ECPublicKeyTest.scala @@ -2,7 +2,6 @@ package org.bitcoins.core.crypto import org.bitcoins.testkit.core.gen.CryptoGenerators import org.bitcoins.testkit.util.BitcoinSUnitTest -import org.scalatest.prop.PropertyChecks import scodec.bits._ class ECPublicKeyTest extends BitcoinSUnitTest { @@ -30,7 +29,7 @@ class ECPublicKeyTest extends BitcoinSUnitTest { } it must "have serialization symmetry from ECPublicKey -> ECPoint -> ECPublicKey" in { - PropertyChecks.forAll(CryptoGenerators.publicKey) { pubKey => + forAll(CryptoGenerators.publicKey) { pubKey => val p = pubKey.toPoint val pub2 = ECPublicKey.fromPoint(p, pubKey.isCompressed) assert(pubKey == pub2) diff --git a/core-test/src/test/scala/org/bitcoins/core/number/BasicArithmeticSpec.scala b/core-test/src/test/scala/org/bitcoins/core/number/BasicArithmeticSpec.scala index d222ea1ccc..a887a86f46 100644 --- a/core-test/src/test/scala/org/bitcoins/core/number/BasicArithmeticSpec.scala +++ b/core-test/src/test/scala/org/bitcoins/core/number/BasicArithmeticSpec.scala @@ -1,7 +1,6 @@ package org.bitcoins.core.number import org.bitcoins.testkit.core.gen.NumberGenerator import org.bitcoins.testkit.util.BitcoinSUnitTest -import org.scalatest.prop.PropertyChecks class BasicArithmeticSpec extends BitcoinSUnitTest { @@ -30,7 +29,7 @@ class BasicArithmeticSpec extends BitcoinSUnitTest { behavior of "BasicArithmetic" it must "multiply safely and unsafely with an int" in { - PropertyChecks.forAll(NumberGenerator.bigInts, numWrapperGen) { (i, num) => + forAll(NumberGenerator.bigInts, numWrapperGen) { (i, num) => val unsafe = num * i val safe = num.multiplySafe(i) assert(safe.toOption.contains(unsafe)) @@ -38,7 +37,7 @@ class BasicArithmeticSpec extends BitcoinSUnitTest { } it must "multiply safely and unsafely with itself" in { - PropertyChecks.forAll(numWrapperGen, numWrapperGen) { (first, second) => + forAll(numWrapperGen, numWrapperGen) { (first, second) => val unsafe = first * second val safe = first.multiplySafe(second) assert(safe.toOption.contains(unsafe)) @@ -46,7 +45,7 @@ class BasicArithmeticSpec extends BitcoinSUnitTest { } it must "add safely and unsafely" in { - PropertyChecks.forAll(numWrapperGen, numWrapperGen) { (first, second) => + forAll(numWrapperGen, numWrapperGen) { (first, second) => val unsafe = first + second val safe = first.addSafe(second) assert(safe.toOption.contains(unsafe)) @@ -54,7 +53,7 @@ class BasicArithmeticSpec extends BitcoinSUnitTest { } it must "subtract safely and unsafely" in { - PropertyChecks.forAll(numWrapperGen, numWrapperGen) { (first, second) => + forAll(numWrapperGen, numWrapperGen) { (first, second) => val unsafe = first - second val safe = first.subtractSafe(second) assert(safe.toOption.contains(unsafe)) diff --git a/core-test/src/test/scala/org/bitcoins/core/number/UInt5Test.scala b/core-test/src/test/scala/org/bitcoins/core/number/UInt5Test.scala index d39e8d6689..0a1bda9618 100644 --- a/core-test/src/test/scala/org/bitcoins/core/number/UInt5Test.scala +++ b/core-test/src/test/scala/org/bitcoins/core/number/UInt5Test.scala @@ -1,13 +1,10 @@ package org.bitcoins.core.number import org.bitcoins.testkit.core.gen.NumberGenerator -import org.scalatest.prop.PropertyChecks -import org.scalatest.{FlatSpec, MustMatchers} +import org.bitcoins.testkit.util.BitcoinSUnitTest import org.slf4j.LoggerFactory -class UInt5Test extends FlatSpec with MustMatchers with PropertyChecks { - - private val logger = LoggerFactory.getLogger(this.getClass) +class UInt5Test extends BitcoinSUnitTest { behavior of "UInt5" diff --git a/core-test/src/test/scala/org/bitcoins/core/protocol/ln/currency/MilliSatoshisTest.scala b/core-test/src/test/scala/org/bitcoins/core/protocol/ln/currency/MilliSatoshisTest.scala index 2d911df656..9e9cf73bb2 100644 --- a/core-test/src/test/scala/org/bitcoins/core/protocol/ln/currency/MilliSatoshisTest.scala +++ b/core-test/src/test/scala/org/bitcoins/core/protocol/ln/currency/MilliSatoshisTest.scala @@ -1,9 +1,8 @@ package org.bitcoins.core.protocol.ln.currency -import org.bitcoins.testkit.core.gen.{CurrencyUnitGenerator, NumberGenerator} import org.bitcoins.testkit.core.gen.ln.LnCurrencyUnitGen +import org.bitcoins.testkit.core.gen.{CurrencyUnitGenerator, NumberGenerator} import org.bitcoins.testkit.util.BitcoinSUnitTest -import org.scalatest.prop.PropertyChecks import org.scalacheck.Gen class MilliSatoshisTest extends BitcoinSUnitTest { diff --git a/core-test/src/test/scala/org/bitcoins/core/util/BitcoinScriptUtilTest.scala b/core-test/src/test/scala/org/bitcoins/core/util/BitcoinScriptUtilTest.scala index c6a9dd424d..91b15bf6a1 100644 --- a/core-test/src/test/scala/org/bitcoins/core/util/BitcoinScriptUtilTest.scala +++ b/core-test/src/test/scala/org/bitcoins/core/util/BitcoinScriptUtilTest.scala @@ -10,17 +10,13 @@ import org.bitcoins.core.script.locktime.OP_CHECKLOCKTIMEVERIFY import org.bitcoins.core.script.reserved.{OP_NOP, OP_RESERVED} import org.bitcoins.core.script.result.ScriptErrorWitnessPubKeyType import org.bitcoins.testkit.core.gen.ScriptGenerators -import org.scalatest.prop.PropertyChecks -import org.scalatest.{FlatSpec, MustMatchers} +import org.bitcoins.testkit.util.BitcoinSUnitTest import scodec.bits.ByteVector /** * Created by chris on 3/2/16. */ -class BitcoinScriptUtilTest - extends FlatSpec - with MustMatchers - with PropertyChecks { +class BitcoinScriptUtilTest extends BitcoinSUnitTest { //from b30d3148927f620f5b1228ba941c211fdabdae75d0ba0b688a58accbf018f3cc val asm = TestUtil.p2pkhScriptPubKey.asm diff --git a/project/Deps.scala b/project/Deps.scala index 2d1833bad0..6abe5987d9 100644 --- a/project/Deps.scala +++ b/project/Deps.scala @@ -6,7 +6,9 @@ object Deps { val bouncyCastle = "1.55" val logback = "1.2.3" val scalacheck = "1.14.2" - val scalaTest = "3.0.8" + val scalaTest = "3.1.0" + + val scalaTestPlus = "3.1.0.0" //super annoying... https://oss.sonatype.org/content/groups/public/org/scalatestplus/ val slf4j = "1.7.29" val spray = "1.3.5" val zeromq = "0.5.1" @@ -97,6 +99,7 @@ object Deps { val scalacheck = "org.scalacheck" %% "scalacheck" % V.scalacheck withSources () withJavadoc () val scalaTest = "org.scalatest" %% "scalatest" % V.scalaTest withSources () withJavadoc () + val scalaTestPlus = "org.scalatestplus" %% "scalacheck-1-14" % V.scalaTestPlus withSources() withJavadoc() } object Test { @@ -231,6 +234,7 @@ object Deps { Compile.slf4j, Compile.scalacheck, Compile.scalaTest, + Compile.scalaTestPlus, Test.akkaTestkit ) diff --git a/testkit/src/main/scala/org/bitcoins/testkit/fixtures/WalletDAOFixture.scala b/testkit/src/main/scala/org/bitcoins/testkit/fixtures/WalletDAOFixture.scala index db9d621786..8bd8d8b65b 100644 --- a/testkit/src/main/scala/org/bitcoins/testkit/fixtures/WalletDAOFixture.scala +++ b/testkit/src/main/scala/org/bitcoins/testkit/fixtures/WalletDAOFixture.scala @@ -2,6 +2,7 @@ package org.bitcoins.testkit.fixtures import org.bitcoins.testkit.wallet.BitcoinSWalletTest import org.scalatest._ +import org.scalatest.flatspec.FixtureAsyncFlatSpec import org.bitcoins.wallet.models._ import org.bitcoins.wallet.config.WalletAppConfig import org.bitcoins.wallet.db.WalletDbManagement @@ -11,7 +12,7 @@ case class WalletDAOs( addressDAO: AddressDAO, utxoDAO: SpendingInfoDAO) -trait WalletDAOFixture extends fixture.AsyncFlatSpec with BitcoinSWalletTest { +trait WalletDAOFixture extends FixtureAsyncFlatSpec with BitcoinSWalletTest { private lazy val daos: WalletDAOs = { val account = AccountDAO() diff --git a/testkit/src/main/scala/org/bitcoins/testkit/util/BitcoinSAsyncTest.scala b/testkit/src/main/scala/org/bitcoins/testkit/util/BitcoinSAsyncTest.scala index 24eac78883..0673e7bc2d 100644 --- a/testkit/src/main/scala/org/bitcoins/testkit/util/BitcoinSAsyncTest.scala +++ b/testkit/src/main/scala/org/bitcoins/testkit/util/BitcoinSAsyncTest.scala @@ -9,6 +9,9 @@ import org.bitcoins.core.util.BitcoinSLogger import org.scalacheck.{Gen, Shrink} import org.scalactic.anyvals.PosInt import org.scalatest._ +import org.scalatest.flatspec.FixtureAsyncFlatSpec +import org.scalatest.flatspec.AsyncFlatSpec +import org.scalatest.matchers.must.Matchers import org.scalatest.concurrent.AsyncTimeLimitedTests import org.scalatest.time.Span import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks @@ -23,7 +26,7 @@ import scala.concurrent.duration.DurationInt trait BaseAsyncTest extends BeforeAndAfter with BeforeAndAfterAll - with MustMatchers + with Matchers with ScalaCheckPropertyChecks with AsyncTimeLimitedTests with BitcoinSLogger { this: AsyncTestSuite => @@ -197,16 +200,16 @@ trait BaseAsyncTest /** A trait that uses [[AsyncFlatSpec]] to execute tests * This is different than [[BitcoinsBaseAsyncTest]] in the sense that * it extends [[AsyncFlatSpec]]. Some test cases in bitcoin-s we want - * to provide fixtures, which means that suite needs to extend [[org.scalatest.fixture.AsyncFlatSpec fixture.AsyncFlatSpec]] + * to provide fixtures, which means that suite needs to extend [[FixtureAsyncFlatSpec FixtureAsyncFlatSpec]] * to be able to use that fixture * * This test trait should be used for async tests that do NOT use a fixture. * */ trait BitcoinSAsyncTest extends AsyncFlatSpec with BaseAsyncTest -/** A trait that uses [[fixture.AsyncFlatSpec fixture.AsyncFlatSpec]] to execute tests +/** A trait that uses [[FixtureAsyncFlatSpec AsyncFlatSpec]] to execute tests * This is different than [[BitcoinSAsyncTest BitcoinSAsyncTest]] as you can use a fixture * with this test suite. * * */ -trait BitcoinSAsyncFixtureTest extends fixture.AsyncFlatSpec with BaseAsyncTest +trait BitcoinSAsyncFixtureTest extends FixtureAsyncFlatSpec with BaseAsyncTest diff --git a/testkit/src/main/scala/org/bitcoins/testkit/util/BitcoinSUnitTest.scala b/testkit/src/main/scala/org/bitcoins/testkit/util/BitcoinSUnitTest.scala index 9bda5e01e2..c3e2b568b7 100644 --- a/testkit/src/main/scala/org/bitcoins/testkit/util/BitcoinSUnitTest.scala +++ b/testkit/src/main/scala/org/bitcoins/testkit/util/BitcoinSUnitTest.scala @@ -6,14 +6,15 @@ import org.scalactic.anyvals.PosInt import org.scalatest.concurrent.TimeLimitedTests import org.scalatest.time.Span import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks -import org.scalatest.{FlatSpec, MustMatchers} +import org.scalatest.matchers.must.Matchers +import org.scalatest.flatspec.AnyFlatSpec import scala.concurrent.duration.DurationInt -/** A wrapper for boiler plate testing procesures in bitcoin-s */ +/** A wrapper for boi ler plate testing procesures in bitcoin-s */ abstract class BitcoinSUnitTest - extends FlatSpec - with MustMatchers + extends AnyFlatSpec + with Matchers with ScalaCheckPropertyChecks with TimeLimitedTests with BitcoinSLogger {