Skip to content

Commit 1262c19

Browse files
committed
add deep stubs test
1 parent f6f142a commit 1262c19

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

mockito-kotlin/src/test/kotlin/MockTest.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525

2626
import com.nhaarman.expect.expect
2727
import com.nhaarman.mockito_kotlin.mock
28+
import com.nhaarman.mockito_kotlin.whenever
2829
import org.junit.Test
30+
import org.mockito.Mockito.RETURNS_DEEP_STUBS
2931
import org.mockito.exceptions.base.MockitoException
32+
import java.util.*
3033

3134
class MockTest {
3235

@@ -82,6 +85,13 @@ class MockTest {
8285
mock<ClosedClass>()
8386
}
8487

88+
@Test
89+
fun deepStubs() {
90+
val cal: Calendar = mock(RETURNS_DEEP_STUBS)
91+
whenever(cal.time.time).thenReturn(123L)
92+
expect(cal.time.time).toBe(123L)
93+
}
94+
8595
private interface MyInterface
8696
private open class MyClass
8797
private class ClosedClass

0 commit comments

Comments
 (0)