@@ -27,36 +27,36 @@ package org.mockito.kotlin
27
27
28
28
import org.mockito.kotlin.internal.createInstance
29
29
import org.mockito.ArgumentMatcher
30
- import org.mockito.Mockito
30
+ import org.mockito.ArgumentMatchers
31
31
32
32
/* * Object argument that is equal to the given value. */
33
33
fun <T > eq (value : T ): T {
34
- return Mockito .eq(value) ? : value
34
+ return ArgumentMatchers .eq(value) ? : value
35
35
}
36
36
37
37
/* * Object argument that is the same as the given value. */
38
38
fun <T > same (value : T ): T {
39
- return Mockito .same(value) ? : value
39
+ return ArgumentMatchers .same(value) ? : value
40
40
}
41
41
42
42
/* * Matches any object, excluding nulls. */
43
43
inline fun <reified T : Any > any (): T {
44
- return Mockito .any(T ::class .java) ? : createInstance()
44
+ return ArgumentMatchers .any(T ::class .java) ? : createInstance()
45
45
}
46
46
47
47
/* * Matches anything, including nulls. */
48
48
inline fun <reified T : Any > anyOrNull (): T {
49
- return Mockito .any<T >() ? : createInstance()
49
+ return ArgumentMatchers .any<T >() ? : createInstance()
50
50
}
51
51
52
52
/* * Matches any vararg object, including nulls. */
53
53
inline fun <reified T : Any > anyVararg (): T {
54
- return Mockito .any<T >() ? : createInstance()
54
+ return ArgumentMatchers .any<T >() ? : createInstance()
55
55
}
56
56
57
57
/* * Matches any array of type T. */
58
58
inline fun <reified T : Any ? > anyArray (): Array <T > {
59
- return Mockito .any(Array <T >::class .java) ? : arrayOf()
59
+ return ArgumentMatchers .any(Array <T >::class .java) ? : arrayOf()
60
60
}
61
61
62
62
/* *
@@ -66,7 +66,7 @@ inline fun <reified T : Any?> anyArray(): Array<T> {
66
66
* @param predicate An extension function on [T] that returns `true` when a [T] matches the predicate.
67
67
*/
68
68
inline fun <reified T : Any > argThat (noinline predicate : T .() -> Boolean ): T {
69
- return Mockito .argThat { arg: T ? -> arg?.predicate() ? : false } ? : createInstance(
69
+ return ArgumentMatchers .argThat { arg: T ? -> arg?.predicate() ? : false } ? : createInstance(
70
70
T ::class
71
71
)
72
72
}
@@ -78,7 +78,7 @@ inline fun <reified T : Any> argThat(noinline predicate: T.() -> Boolean): T {
78
78
* @param matcher The ArgumentMatcher on [T] to be registered.
79
79
*/
80
80
inline fun <reified T : Any > argThat (matcher : ArgumentMatcher <T >): T {
81
- return Mockito .argThat(matcher) ? : createInstance()
81
+ return ArgumentMatchers .argThat(matcher) ? : createInstance()
82
82
}
83
83
84
84
/* *
@@ -107,33 +107,33 @@ inline fun <reified T : Any> argWhere(noinline predicate: (T) -> Boolean): T {
107
107
* Argument that implements the given class.
108
108
*/
109
109
inline fun <reified T : Any > isA (): T {
110
- return Mockito .isA(T ::class .java) ? : createInstance()
110
+ return ArgumentMatchers .isA(T ::class .java) ? : createInstance()
111
111
}
112
112
113
113
/* *
114
114
* `null` argument.
115
115
*/
116
- fun <T : Any > isNull (): T ? = Mockito .isNull()
116
+ fun <T : Any > isNull (): T ? = ArgumentMatchers .isNull()
117
117
118
118
/* *
119
119
* Not `null` argument.
120
120
*/
121
121
fun <T : Any > isNotNull (): T ? {
122
- return Mockito .isNotNull()
122
+ return ArgumentMatchers .isNotNull()
123
123
}
124
124
125
125
/* *
126
126
* Not `null` argument.
127
127
*/
128
128
fun <T : Any > notNull (): T ? {
129
- return Mockito .notNull()
129
+ return ArgumentMatchers .notNull()
130
130
}
131
131
132
132
/* *
133
133
* Object argument that is reflection-equal to the given value with support for excluding
134
134
* selected fields from a class.
135
135
*/
136
136
inline fun <reified T : Any > refEq (value : T , vararg excludeFields : String ): T {
137
- return Mockito .refEq<T >(value, * excludeFields) ? : createInstance()
137
+ return ArgumentMatchers .refEq<T >(value, * excludeFields) ? : createInstance()
138
138
}
139
139
0 commit comments