diff options
author | Niek Haarman <haarman.niek@gmail.com> | 2019-07-05 15:03:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-05 15:03:46 +0200 |
commit | 5c51a89bd5a3c8c067cc84f10a2e9363d3930269 (patch) | |
tree | a4c223c3e6673b246a28b0bdd57dea4c5bcb10e5 | |
parent | 4779b29d3fe670e82f358eec8e8daf12e95d8004 (diff) | |
parent | feaf63e2ea38828b25dd23bf34a8128aefe0d50b (diff) | |
download | mockito-kotlin-5c51a89bd5a3c8c067cc84f10a2e9363d3930269.tar.gz |
Merge pull request #351 from nhaarman/after_bangs
Make after() return type non-null
-rw-r--r-- | mockito-kotlin/src/main/kotlin/com/nhaarman/mockitokotlin2/Verification.kt | 4 | ||||
-rw-r--r-- | tests/src/test/kotlin/test/VerificationTest.kt | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/mockito-kotlin/src/main/kotlin/com/nhaarman/mockitokotlin2/Verification.kt b/mockito-kotlin/src/main/kotlin/com/nhaarman/mockitokotlin2/Verification.kt index b52e61e..b8e124c 100644 --- a/mockito-kotlin/src/main/kotlin/com/nhaarman/mockitokotlin2/Verification.kt +++ b/mockito-kotlin/src/main/kotlin/com/nhaarman/mockitokotlin2/Verification.kt @@ -165,8 +165,8 @@ fun description(description: String): VerificationMode { * interaction rather than failing immediately if has not already happened. May be useful for testing in concurrent * conditions. */ -fun after(millis: Long): VerificationAfterDelay? { - return Mockito.after(millis) +fun after(millis: Long): VerificationAfterDelay { + return Mockito.after(millis)!! } /** diff --git a/tests/src/test/kotlin/test/VerificationTest.kt b/tests/src/test/kotlin/test/VerificationTest.kt index c2253bc..1858dec 100644 --- a/tests/src/test/kotlin/test/VerificationTest.kt +++ b/tests/src/test/kotlin/test/VerificationTest.kt @@ -103,4 +103,12 @@ class VerificationTest : TestBase() { expect(e.message).toContain("Test") } } + + @Test + fun testAfter() { + mock<Methods>().apply { + int(3) + verify(this, after(10)).int(3) + } + } }
\ No newline at end of file |