Skip to content

Commit 5f236e4

Browse files
committed
New SBT/Scala version and/or additional checks cause CircleCI to fail; sbt test runs green locally.
1 parent 81b16be commit 5f236e4

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

common/src/main/scala/org/mockito/MockitoAPI.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,8 @@ private[mockito] trait MockitoEnhancer extends MockCreator {
626626
/**
627627
* Mocks the specified object only for the context of the block
628628
*/
629-
def withObjectMocked[O <: AnyRef: ClassTag](block: => Any)(implicit defaultAnswer: DefaultAnswer, $pt: Prettifier): Unit = {
629+
def withObjectMocked[O <: AnyRef: ClassTag](block: => Any)(implicit defaultAnswer: DefaultAnswer, $pt: Prettifier): Unit =
630630
withObject[O](_ => withSettings(defaultAnswer), block)
631-
}
632631

633632
/**
634633
* Spies the specified object only for the context of the block
@@ -661,8 +660,13 @@ trait LeniencySettings {
661660
}
662661

663662
object LeniencySettings {
664-
implicit val strictStubs: LeniencySettings = identity
665-
val lenientStubs: LeniencySettings = _.lenient()
663+
implicit val strictStubs: LeniencySettings = new LeniencySettings {
664+
override def apply(settings: MockSettings): MockSettings = settings
665+
}
666+
667+
val lenientStubs: LeniencySettings = new LeniencySettings {
668+
override def apply(settings: MockSettings): MockSettings = settings.lenient()
669+
}
666670
}
667671

668672
private[mockito] trait Verifications {

scalatest/src/test/scala/user/org/mockito/IdiomaticStubbingTest.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ package user.org.mockito
33
import java.util.concurrent.atomic.AtomicInteger
44

55
import org.mockito.invocation.InvocationOnMock
6-
import org.mockito.{ArgumentMatchersSugar, IdiomaticStubbing}
6+
import org.mockito.{ ArgumentMatchersSugar, IdiomaticStubbing }
77
import org.scalatest.matchers.should.Matchers
88
import org.scalatest.wordspec.AnyWordSpec
9-
import user.org.mockito.matchers.{ValueCaseClassInt, ValueCaseClassString, ValueClass}
9+
import user.org.mockito.matchers.{ ValueCaseClassInt, ValueCaseClassString, ValueClass }
1010
import scala.collection.parallel.immutable
11-
import scala.concurrent.{Await, Future}
11+
import scala.concurrent.{ Await, Future }
1212
import scala.util.Random
1313

14-
class IdiomaticStubbingTest extends AnyWordSpec with Matchers with ArgumentMatchersSugar with IdiomaticMockitoTestSetup with IdiomaticStubbing{
14+
class IdiomaticStubbingTest extends AnyWordSpec with Matchers with ArgumentMatchersSugar with IdiomaticMockitoTestSetup with IdiomaticStubbing {
1515

1616
forAll(scenarios) { (testDouble, orgDouble, foo) =>
1717
testDouble should {
@@ -295,7 +295,6 @@ class IdiomaticStubbingTest extends AnyWordSpec with Matchers with ArgumentMatch
295295
org.doSomethingWithThisIntAndStringAndBoolean(1, "2", v3 = false) shouldBe ""
296296
}
297297

298-
299298
"stub an object method" in {
300299
FooObject.simpleMethod shouldBe "not mocked!"
301300

0 commit comments

Comments
 (0)