We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9fb8a57 commit 4a5716cCopy full SHA for 4a5716c
core/src/test/scala/org/mockito/MockitoSugarTest.scala
@@ -20,6 +20,8 @@ class MockitoSugarTest
20
def iStartWithByNameArgs(byName: => String, normal: String): String = s"$normal - $byName"
21
22
def iHaveFunction0Args(normal: String, f0: () => String): String = s"$normal - $f0"
23
+
24
+ def returnBar: Bar = ???
25
}
26
27
class Bar {
@@ -42,6 +44,14 @@ class MockitoSugarTest
42
44
aMock.bar shouldBe "mocked!"
43
45
46
47
+ "create a mock while stubbing another" in {
48
+ val aMock = mock[Foo]
49
50
+ when(aMock.returnBar) thenReturn mock[Bar]
51
52
+ aMock.returnBar shouldBe a[Bar]
53
+ }
54
55
"default answer should deal with default arguments" in {
56
val aMock = mock[Foo]
57
0 commit comments