From 63826bfaf04dbde8895353c11f804d907d92d8c4 Mon Sep 17 00:00:00 2001 From: Niek Haarman Date: Fri, 21 Oct 2016 22:40:17 +0200 Subject: [PATCH] Upgrade deprecation levels to ERROR --- .../nhaarman/mockito_kotlin/ArgumentCaptor.kt | 4 +-- .../com/nhaarman/mockito_kotlin/Mockito.kt | 8 ++--- mockito-kotlin/src/test/kotlin/MockitoTest.kt | 36 ------------------- 3 files changed, 6 insertions(+), 42 deletions(-) diff --git a/mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/ArgumentCaptor.kt b/mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/ArgumentCaptor.kt index dcbbe43a..cc25b3b2 100644 --- a/mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/ArgumentCaptor.kt +++ b/mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/ArgumentCaptor.kt @@ -32,7 +32,7 @@ inline fun argumentCaptor(): KArgumentCaptor = KArgumentCap inline fun capture(captor: ArgumentCaptor): T = captor.capture() ?: createInstance() -@Deprecated("Use captor.capture() instead.", ReplaceWith("captor.capture()")) +@Deprecated("Use captor.capture() instead.", ReplaceWith("captor.capture()"), DeprecationLevel.ERROR) inline fun capture(captor: KArgumentCaptor): T = captor.capture() class KArgumentCaptor(private val captor: ArgumentCaptor, private val tClass: KClass) { @@ -51,7 +51,7 @@ class KArgumentCaptor(private val captor: ArgumentCaptor, privat * Instead, use [argumentCaptor] in the traditional way, or use one of * [argThat], [argForWhich] or [check]. */ -@Deprecated("Use argumentCaptor() or argThat() instead.") +@Deprecated("Use argumentCaptor() or argThat() instead.", ReplaceWith("check(consumer)"), DeprecationLevel.ERROR) inline fun capture(noinline consumer: (T) -> Unit): T { var times = 0 return argThat { if (++times == 1) consumer.invoke(this); true } diff --git a/mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/Mockito.kt b/mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/Mockito.kt index dc6e67b4..86fc85da 100644 --- a/mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/Mockito.kt +++ b/mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/Mockito.kt @@ -130,14 +130,14 @@ fun verifyZeroInteractions(vararg mocks: Any) = Mockito.verifyZeroInteractions(* fun whenever(methodCall: T): OngoingStubbing = Mockito.`when`(methodCall)!! fun withSettings(): MockSettings = Mockito.withSettings()!! -@Deprecated("Use any() instead.", ReplaceWith("any()")) +@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR) inline fun anyCollection(): Collection = any() -@Deprecated("Use any() instead.", ReplaceWith("any()")) +@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR) inline fun anyList(): List = any() -@Deprecated("Use any() instead.", ReplaceWith("any()")) +@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR) inline fun anySet(): Set = any() -@Deprecated("Use any() instead.", ReplaceWith("any()")) +@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR) inline fun anyMap(): Map = any() diff --git a/mockito-kotlin/src/test/kotlin/MockitoTest.kt b/mockito-kotlin/src/test/kotlin/MockitoTest.kt index 897e0d3f..723cb374 100644 --- a/mockito-kotlin/src/test/kotlin/MockitoTest.kt +++ b/mockito-kotlin/src/test/kotlin/MockitoTest.kt @@ -73,42 +73,6 @@ class MockitoTest { } } - @Test - fun anyCollectionOfClosed() { - mock().apply { - closedCollection(listOf()) - verify(this).closedCollection(any()) - verify(this).closedCollection(anyCollection()) - } - } - - @Test - fun anyListOfClosed() { - mock().apply { - closedList(listOf()) - verify(this).closedList(any()) - verify(this).closedList(anyList()) - } - } - - @Test - fun anyClosedStringMap() { - mock().apply { - closedStringMap(mapOf()) - verify(this).closedStringMap(any()) - verify(this).closedStringMap(anyMap()) - } - } - - @Test - fun anyClosedSet() { - mock().apply { - closedSet(setOf()) - verify(this).closedSet(any()) - verify(this).closedSet(anySet()) - } - } - @Test fun anyStringVararg() { mock().apply {