Skip to content

Commit

Permalink
bump Scala, sbt, ScalaTest versions (#264)
Browse files Browse the repository at this point in the history
* bump ScalaTest version to 3.2.0

also bump sbt version to 1.3.13

* bump Scala version to 2.13.3
  • Loading branch information
SethTisue authored Jul 9, 2020
1 parent 50c64c3 commit 50bad8b
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 30 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/org/mockito/IdiomaticMockitoBase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.3.12
sbt.version=1.3.13
Original file line number Diff line number Diff line change
@@ -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 = ???
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ 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
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!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ???

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ 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
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!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 50bad8b

Please sign in to comment.