Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade deprecation levels to ERROR #97

Merged
merged 1 commit into from
Oct 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ inline fun <reified T : Any> argumentCaptor(): KArgumentCaptor<T> = KArgumentCap

inline fun <reified T : Any> capture(captor: ArgumentCaptor<T>): T = captor.capture() ?: createInstance<T>()

@Deprecated("Use captor.capture() instead.", ReplaceWith("captor.capture()"))
@Deprecated("Use captor.capture() instead.", ReplaceWith("captor.capture()"), DeprecationLevel.ERROR)
inline fun <reified T : Any> capture(captor: KArgumentCaptor<T>): T = captor.capture()

class KArgumentCaptor<out T : Any>(private val captor: ArgumentCaptor<T>, private val tClass: KClass<T>) {
Expand All @@ -51,7 +51,7 @@ class KArgumentCaptor<out T : Any>(private val captor: ArgumentCaptor<T>, 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 <reified T : Any> capture(noinline consumer: (T) -> Unit): T {
var times = 0
return argThat { if (++times == 1) consumer.invoke(this); true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ fun verifyZeroInteractions(vararg mocks: Any) = Mockito.verifyZeroInteractions(*
fun <T> whenever(methodCall: T): OngoingStubbing<T> = Mockito.`when`(methodCall)!!
fun withSettings(): MockSettings = Mockito.withSettings()!!

@Deprecated("Use any() instead.", ReplaceWith("any()"))
@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
inline fun <reified T : Any> anyCollection(): Collection<T> = any()

@Deprecated("Use any() instead.", ReplaceWith("any()"))
@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
inline fun <reified T : Any> anyList(): List<T> = any()

@Deprecated("Use any() instead.", ReplaceWith("any()"))
@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
inline fun <reified T : Any> anySet(): Set<T> = any()

@Deprecated("Use any() instead.", ReplaceWith("any()"))
@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
inline fun <reified K : Any, reified V : Any> anyMap(): Map<K, V> = any()
36 changes: 0 additions & 36 deletions mockito-kotlin/src/test/kotlin/MockitoTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,42 +73,6 @@ class MockitoTest {
}
}

@Test
fun anyCollectionOfClosed() {
mock<Methods>().apply {
closedCollection(listOf())
verify(this).closedCollection(any())
verify(this).closedCollection(anyCollection())
}
}

@Test
fun anyListOfClosed() {
mock<Methods>().apply {
closedList(listOf())
verify(this).closedList(any())
verify(this).closedList(anyList())
}
}

@Test
fun anyClosedStringMap() {
mock<Methods>().apply {
closedStringMap(mapOf())
verify(this).closedStringMap(any())
verify(this).closedStringMap(anyMap())
}
}

@Test
fun anyClosedSet() {
mock<Methods>().apply {
closedSet(setOf())
verify(this).closedSet(any())
verify(this).closedSet(anySet())
}
}

@Test
fun anyStringVararg() {
mock<Methods>().apply {
Expand Down