From 50bad8b7fbf449db9768372addf4c5eddde038b0 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 9 Jul 2020 03:14:52 -0500 Subject: [PATCH] bump Scala, sbt, ScalaTest versions (#264) * bump ScalaTest version to 3.2.0 also bump sbt version to 1.3.13 * bump Scala version to 2.13.3 --- build.sbt | 2 +- .../cats/instances/ArgumentMatcherInstancesTest.scala | 2 +- core/src/main/scala/org/mockito/IdiomaticMockitoBase.scala | 2 +- project/Dependencies.scala | 2 +- project/build.properties | 2 +- .../scala-2.11/user/org/mockito/MockitoSugarTest_211.scala | 5 +++-- .../user/org/mockito/stubbing/ReturnsEmptyValuesTest.scala | 6 ++++-- .../user/org/mockito/IdiomaticMockitoTest_212.scala | 5 +++-- .../scala-2.12/user/org/mockito/MockitoSugarTest_212.scala | 5 +++-- .../mockito/scalatest/AsyncIdiomaticMockitoTest_212.scala | 3 ++- .../user/org/mockito/stubbing/ReturnsEmptyValuesTest.scala | 6 ++++-- .../src/test/scala/user/org/mockito/DoSomethingTest.scala | 1 - .../src/test/scala/user/org/mockito/MockitoSugar$Test.scala | 1 - .../test/scala/user/org/mockito/captor/ArgCaptorTest.scala | 4 ++-- .../scala/user/org/mockito/matchers/AnyMatchersTest.scala | 1 - .../scala/user/org/mockito/matchers/EqMatchersTest.scala | 1 - .../user/org/mockito/matchers/FunctionMatchersTest.scala | 1 - .../scala/user/org/mockito/matchers/ThatMatchersTest.scala | 1 - .../scalatest/IdiomaticMockitoFixtureClassTest.scala | 4 ++-- .../IdiomaticMockitoWithExpectFixtureClassTest.scala | 4 ++-- .../test/scala/org/mockito/specs2/MockitoScalaSpec.scala | 4 ++-- 21 files changed, 32 insertions(+), 30 deletions(-) diff --git a/build.sbt b/build.sbt index 2bd490d9..e876fb71 100644 --- a/build.sbt +++ b/build.sbt @@ -4,7 +4,7 @@ import scala.io.Source import scala.language.postfixOps import scala.util.Try -val currentScalaVersion = "2.13.2" +val currentScalaVersion = "2.13.3" ThisBuild / scalaVersion := currentScalaVersion diff --git a/cats/src/test/scala/org/mockito/cats/instances/ArgumentMatcherInstancesTest.scala b/cats/src/test/scala/org/mockito/cats/instances/ArgumentMatcherInstancesTest.scala index ac68c8d0..e9c79edd 100644 --- a/cats/src/test/scala/org/mockito/cats/instances/ArgumentMatcherInstancesTest.scala +++ b/cats/src/test/scala/org/mockito/cats/instances/ArgumentMatcherInstancesTest.scala @@ -9,7 +9,7 @@ import cats.laws.discipline.eq._ import org.mockito.{ ArgumentMatcher, ArgumentMatchers, ArgumentMatchersSugar, IdiomaticMockito } import org.mockito.internal.matchers._ import org.scalacheck.Arbitrary -import org.scalatest.Matchers +import org.scalatest.matchers.should.Matchers import org.scalatest.funsuite.AnyFunSuiteLike import org.scalatest.prop.Configuration import org.typelevel.discipline.scalatest.FunSuiteDiscipline diff --git a/core/src/main/scala/org/mockito/IdiomaticMockitoBase.scala b/core/src/main/scala/org/mockito/IdiomaticMockitoBase.scala index f868685a..bfba5ffc 100644 --- a/core/src/main/scala/org/mockito/IdiomaticMockitoBase.scala +++ b/core/src/main/scala/org/mockito/IdiomaticMockitoBase.scala @@ -84,7 +84,7 @@ object IdiomaticMockitoBase { } class ReturnActions[T](os: ScalaFirstStubbing[T]) { - def apply(value: T, values: T*): ScalaOngoingStubbing[T] = os thenReturn (value, values: _*) + def apply(value: T, values: T*): ScalaOngoingStubbing[T] = os.thenReturn(value, values: _*) } class ThrowActions[T](os: ScalaFirstStubbing[T]) { diff --git a/project/Dependencies.scala b/project/Dependencies.scala index f68587f3..e8e5ff73 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -2,7 +2,7 @@ import sbt._ object Dependencies { - val scalatestVersion = "3.1.2" + val scalatestVersion = "3.2.0" val commonLibraries = Seq( "org.mockito" % "mockito-core" % "3.3.3", diff --git a/project/build.properties b/project/build.properties index 0caa33f3..d7ec7acf 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.12 \ No newline at end of file +sbt.version=1.3.13 \ No newline at end of file diff --git a/scalatest/src/test/scala-2.11/user/org/mockito/MockitoSugarTest_211.scala b/scalatest/src/test/scala-2.11/user/org/mockito/MockitoSugarTest_211.scala index 134b79b5..eab2e6a3 100644 --- a/scalatest/src/test/scala-2.11/user/org/mockito/MockitoSugarTest_211.scala +++ b/scalatest/src/test/scala-2.11/user/org/mockito/MockitoSugarTest_211.scala @@ -1,9 +1,10 @@ package user.org.mockito import org.mockito.{ ArgumentMatchersSugar, MockitoSugar } -import org.scalatest.{ Matchers, WordSpec } +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec -class MockitoSugarTest_211 extends WordSpec with MockitoSugar with Matchers with ArgumentMatchersSugar { +class MockitoSugarTest_211 extends AnyWordSpec with MockitoSugar with Matchers with ArgumentMatchersSugar { trait Baz { def traitMethod(defaultArg: Int = 30, anotherDefault: String = "hola"): Int = ??? } diff --git a/scalatest/src/test/scala-2.11/user/org/mockito/stubbing/ReturnsEmptyValuesTest.scala b/scalatest/src/test/scala-2.11/user/org/mockito/stubbing/ReturnsEmptyValuesTest.scala index 1604ca00..5b301397 100644 --- a/scalatest/src/test/scala-2.11/user/org/mockito/stubbing/ReturnsEmptyValuesTest.scala +++ b/scalatest/src/test/scala-2.11/user/org/mockito/stubbing/ReturnsEmptyValuesTest.scala @@ -3,7 +3,9 @@ package user.org.mockito.stubbing import org.mockito.exceptions.base.MockitoException import org.mockito.{ DefaultAnswers, IdiomaticMockito } import org.scalatest.concurrent.ScalaFutures -import org.scalatest.{ Matchers, OptionValues, TryValues, WordSpec } +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec +import org.scalatest.{ OptionValues, TryValues } import user.org.mockito.stubbing.DefaultAnswerTest._ import scala.collection.mutable @@ -11,7 +13,7 @@ import scala.collection.mutable.ListBuffer import scala.concurrent.Future import scala.util.{ Success, Try } -class ReturnsEmptyValuesTest extends WordSpec with Matchers with IdiomaticMockito with TryValues with OptionValues with ScalaFutures { +class ReturnsEmptyValuesTest extends AnyWordSpec with Matchers with IdiomaticMockito with TryValues with OptionValues with ScalaFutures { class KnownTypes { def returnsOption: Option[String] = Some("not mocked!") def returnsList: List[String] = List("not mocked!") diff --git a/scalatest/src/test/scala-2.12/user/org/mockito/IdiomaticMockitoTest_212.scala b/scalatest/src/test/scala-2.12/user/org/mockito/IdiomaticMockitoTest_212.scala index 3c45d7d8..9d2ecf45 100644 --- a/scalatest/src/test/scala-2.12/user/org/mockito/IdiomaticMockitoTest_212.scala +++ b/scalatest/src/test/scala-2.12/user/org/mockito/IdiomaticMockitoTest_212.scala @@ -2,13 +2,14 @@ package user.org.mockito import org.mockito.{ ArgumentMatchersSugar, IdiomaticMockito } import org.scalatest.concurrent.ScalaFutures -import org.scalatest.{ Matchers, WordSpec } +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec import user.org.mockito.matchers.{ ValueCaseClassInt, ValueClass } import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future -class IdiomaticMockitoTest_212 extends WordSpec with Matchers with IdiomaticMockito with ArgumentMatchersSugar with ScalaFutures { +class IdiomaticMockitoTest_212 extends AnyWordSpec with Matchers with IdiomaticMockito with ArgumentMatchersSugar with ScalaFutures { class Foo { def valueClass(n: Int, v: ValueClass): String = ??? diff --git a/scalatest/src/test/scala-2.12/user/org/mockito/MockitoSugarTest_212.scala b/scalatest/src/test/scala-2.12/user/org/mockito/MockitoSugarTest_212.scala index df9b19a9..fb03ae8e 100644 --- a/scalatest/src/test/scala-2.12/user/org/mockito/MockitoSugarTest_212.scala +++ b/scalatest/src/test/scala-2.12/user/org/mockito/MockitoSugarTest_212.scala @@ -3,13 +3,14 @@ package user.org.mockito import org.mockito.{ ArgumentMatchersSugar, MockitoSugar } import org.scalatest.concurrent.ScalaFutures import org.scalatest.prop.TableDrivenPropertyChecks -import org.scalatest.{ Matchers, WordSpec } +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future //noinspection RedundantDefaultArgument -class MockitoSugarTest_212 extends WordSpec with MockitoSugar with Matchers with ArgumentMatchersSugar with TableDrivenPropertyChecks with ScalaFutures { +class MockitoSugarTest_212 extends AnyWordSpec with MockitoSugar with Matchers with ArgumentMatchersSugar with TableDrivenPropertyChecks with ScalaFutures { val scenarios = Table( ("testDouble", "foo", "baz"), ("mock", () => mock[Foo], () => mock[Baz]), diff --git a/scalatest/src/test/scala-2.12/user/org/mockito/scalatest/AsyncIdiomaticMockitoTest_212.scala b/scalatest/src/test/scala-2.12/user/org/mockito/scalatest/AsyncIdiomaticMockitoTest_212.scala index a43db1eb..fcafef96 100644 --- a/scalatest/src/test/scala-2.12/user/org/mockito/scalatest/AsyncIdiomaticMockitoTest_212.scala +++ b/scalatest/src/test/scala-2.12/user/org/mockito/scalatest/AsyncIdiomaticMockitoTest_212.scala @@ -1,7 +1,8 @@ package user.org.mockito.scalatest import org.mockito.scalatest.AsyncIdiomaticMockito -import org.scalatest.{ AsyncWordSpec, Matchers } +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AsyncWordSpec import scala.concurrent.Future diff --git a/scalatest/src/test/scala-2.12/user/org/mockito/stubbing/ReturnsEmptyValuesTest.scala b/scalatest/src/test/scala-2.12/user/org/mockito/stubbing/ReturnsEmptyValuesTest.scala index 1604ca00..5b301397 100644 --- a/scalatest/src/test/scala-2.12/user/org/mockito/stubbing/ReturnsEmptyValuesTest.scala +++ b/scalatest/src/test/scala-2.12/user/org/mockito/stubbing/ReturnsEmptyValuesTest.scala @@ -3,7 +3,9 @@ package user.org.mockito.stubbing import org.mockito.exceptions.base.MockitoException import org.mockito.{ DefaultAnswers, IdiomaticMockito } import org.scalatest.concurrent.ScalaFutures -import org.scalatest.{ Matchers, OptionValues, TryValues, WordSpec } +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec +import org.scalatest.{ OptionValues, TryValues } import user.org.mockito.stubbing.DefaultAnswerTest._ import scala.collection.mutable @@ -11,7 +13,7 @@ import scala.collection.mutable.ListBuffer import scala.concurrent.Future import scala.util.{ Success, Try } -class ReturnsEmptyValuesTest extends WordSpec with Matchers with IdiomaticMockito with TryValues with OptionValues with ScalaFutures { +class ReturnsEmptyValuesTest extends AnyWordSpec with Matchers with IdiomaticMockito with TryValues with OptionValues with ScalaFutures { class KnownTypes { def returnsOption: Option[String] = Some("not mocked!") def returnsList: List[String] = List("not mocked!") diff --git a/scalatest/src/test/scala/user/org/mockito/DoSomethingTest.scala b/scalatest/src/test/scala/user/org/mockito/DoSomethingTest.scala index 8151ef56..63f543a2 100644 --- a/scalatest/src/test/scala/user/org/mockito/DoSomethingTest.scala +++ b/scalatest/src/test/scala/user/org/mockito/DoSomethingTest.scala @@ -4,7 +4,6 @@ import java.util.concurrent.atomic.AtomicInteger import org.mockito.invocation.InvocationOnMock import org.mockito.{ ArgumentMatchersSugar, MockitoSugar } -import org.scalatest.{ Matchers => ScalaTestMatchers } import user.org.mockito.matchers.{ ValueCaseClassInt, ValueCaseClassString, ValueClass } import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec diff --git a/scalatest/src/test/scala/user/org/mockito/MockitoSugar$Test.scala b/scalatest/src/test/scala/user/org/mockito/MockitoSugar$Test.scala index 6384a7d6..e22e6d7a 100644 --- a/scalatest/src/test/scala/user/org/mockito/MockitoSugar$Test.scala +++ b/scalatest/src/test/scala/user/org/mockito/MockitoSugar$Test.scala @@ -2,7 +2,6 @@ package user.org.mockito import org.mockito.MockitoSugar import org.mockito.stubbing.{ CallsRealMethods, DefaultAnswer, ReturnsDefaults } -import org.scalatest.{ Matchers => ScalatestMatchers } import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec diff --git a/scalatest/src/test/scala/user/org/mockito/captor/ArgCaptorTest.scala b/scalatest/src/test/scala/user/org/mockito/captor/ArgCaptorTest.scala index 7a0e2371..1edd3b9f 100644 --- a/scalatest/src/test/scala/user/org/mockito/captor/ArgCaptorTest.scala +++ b/scalatest/src/test/scala/user/org/mockito/captor/ArgCaptorTest.scala @@ -96,8 +96,8 @@ class ArgCaptorTest extends AnyWordSpec with MockitoSugar with Matchers { verify(aMock, times(2)).stringArgument(captor) - captor.values should contain only ("it worked!", "it worked again!") - captor hasCaptured ("it worked!", "it worked again!") + captor.values.should(contain).only("it worked!", "it worked again!") + captor.hasCaptured("it worked!", "it worked again!") } "work with value case classes" in { diff --git a/scalatest/src/test/scala/user/org/mockito/matchers/AnyMatchersTest.scala b/scalatest/src/test/scala/user/org/mockito/matchers/AnyMatchersTest.scala index 6448edc3..1ea138b3 100644 --- a/scalatest/src/test/scala/user/org/mockito/matchers/AnyMatchersTest.scala +++ b/scalatest/src/test/scala/user/org/mockito/matchers/AnyMatchersTest.scala @@ -1,7 +1,6 @@ package user.org.mockito.matchers import org.mockito.{ ArgumentMatchersSugar, MockitoSugar } -import org.scalatest.{ Matchers => ScalaTestMatchers } import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers diff --git a/scalatest/src/test/scala/user/org/mockito/matchers/EqMatchersTest.scala b/scalatest/src/test/scala/user/org/mockito/matchers/EqMatchersTest.scala index 74415d81..31fe917a 100644 --- a/scalatest/src/test/scala/user/org/mockito/matchers/EqMatchersTest.scala +++ b/scalatest/src/test/scala/user/org/mockito/matchers/EqMatchersTest.scala @@ -2,7 +2,6 @@ package user.org.mockito.matchers import org.mockito.{ ArgumentMatchersSugar, MockitoSugar } import org.scalactic.{ Equality, StringNormalizations } -import org.scalatest.{ Matchers => ScalaTestMatchers } import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers diff --git a/scalatest/src/test/scala/user/org/mockito/matchers/FunctionMatchersTest.scala b/scalatest/src/test/scala/user/org/mockito/matchers/FunctionMatchersTest.scala index 93f85a7a..5313de38 100644 --- a/scalatest/src/test/scala/user/org/mockito/matchers/FunctionMatchersTest.scala +++ b/scalatest/src/test/scala/user/org/mockito/matchers/FunctionMatchersTest.scala @@ -2,7 +2,6 @@ package user.org.mockito.matchers import org.mockito.{ ArgumentMatchersSugar, MockitoSugar } import org.mockito.exceptions.verification.ArgumentsAreDifferent -import org.scalatest.{ Matchers => ScalaTestMatchers } import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec diff --git a/scalatest/src/test/scala/user/org/mockito/matchers/ThatMatchersTest.scala b/scalatest/src/test/scala/user/org/mockito/matchers/ThatMatchersTest.scala index 89974bbb..e87be748 100644 --- a/scalatest/src/test/scala/user/org/mockito/matchers/ThatMatchersTest.scala +++ b/scalatest/src/test/scala/user/org/mockito/matchers/ThatMatchersTest.scala @@ -3,7 +3,6 @@ package user.org.mockito.matchers import org.mockito.exceptions.verification.WantedButNotInvoked import org.mockito.matchers.EqTo import org.mockito.{ ArgumentMatchersSugar, MockitoSugar } -import org.scalatest.{ Matchers => ScalaTestMatchers } import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers diff --git a/scalatest/src/test/scala/user/org/mockito/scalatest/IdiomaticMockitoFixtureClassTest.scala b/scalatest/src/test/scala/user/org/mockito/scalatest/IdiomaticMockitoFixtureClassTest.scala index 5745d358..0ade3c4e 100644 --- a/scalatest/src/test/scala/user/org/mockito/scalatest/IdiomaticMockitoFixtureClassTest.scala +++ b/scalatest/src/test/scala/user/org/mockito/scalatest/IdiomaticMockitoFixtureClassTest.scala @@ -3,9 +3,9 @@ package user.org.mockito.scalatest import org.mockito.exceptions.verification.{ NeverWantedButInvoked, NoInteractionsWanted } import org.mockito.scalatest.IdiomaticMockito import org.scalatest.matchers.should.Matchers -import org.scalatest.{ fixture, Outcome } +import org.scalatest.{ flatspec, Outcome } -class IdiomaticMockitoFixtureClassTest extends fixture.FlatSpec with IdiomaticMockito with Matchers { +class IdiomaticMockitoFixtureClassTest extends flatspec.FixtureAnyFlatSpec with IdiomaticMockito with Matchers { class Foo { def bar(a: String) = "bar" def baz = "baz" diff --git a/scalatest/src/test/scala/user/org/mockito/scalatest/IdiomaticMockitoWithExpectFixtureClassTest.scala b/scalatest/src/test/scala/user/org/mockito/scalatest/IdiomaticMockitoWithExpectFixtureClassTest.scala index 91d63180..15159caf 100644 --- a/scalatest/src/test/scala/user/org/mockito/scalatest/IdiomaticMockitoWithExpectFixtureClassTest.scala +++ b/scalatest/src/test/scala/user/org/mockito/scalatest/IdiomaticMockitoWithExpectFixtureClassTest.scala @@ -5,9 +5,9 @@ import org.mockito.exceptions.misusing.MissingMethodInvocationException import org.mockito.exceptions.verification.{ NeverWantedButInvoked, NoInteractionsWanted } import org.mockito.scalatest.IdiomaticMockitoBase import org.scalatest.matchers.should.Matchers -import org.scalatest.{ fixture, Outcome } +import org.scalatest.{ flatspec, Outcome } -class IdiomaticMockitoWithExpectFixtureClassTest extends fixture.FlatSpec with IdiomaticMockitoBase with PrefixExpectations with Matchers { +class IdiomaticMockitoWithExpectFixtureClassTest extends flatspec.FixtureAnyFlatSpec with IdiomaticMockitoBase with PrefixExpectations with Matchers { class Foo { def bar(a: String) = "bar" def baz = "baz" diff --git a/specs2/src/test/scala/org/mockito/specs2/MockitoScalaSpec.scala b/specs2/src/test/scala/org/mockito/specs2/MockitoScalaSpec.scala index a6bb50ed..6cc15262 100644 --- a/specs2/src/test/scala/org/mockito/specs2/MockitoScalaSpec.scala +++ b/specs2/src/test/scala/org/mockito/specs2/MockitoScalaSpec.scala @@ -376,7 +376,7 @@ The Mockito trait is reusable in other contexts def stubs2 = { val list = mock[java.util.List[String]] - list.add("one") returns (true, false, true) + list.add("one").returns(true, false, true) (list.add("one"), list.add("one"), list.add("one")) must_== ((true, false, true)) } @@ -427,7 +427,7 @@ The Mockito trait is reusable in other contexts def stubs9 = { val list = mock[java.util.List[String]] - list.clear() throws (new RuntimeException, new IllegalArgumentException) + list.clear().throws(new RuntimeException, new IllegalArgumentException) tryo(list.clear()) list.clear() } must throwAn[IllegalArgumentException]