android-components /



Name Summary
KArgumentCaptor class KArgumentCaptor<out T>


Name Summary
any fun <T> any(): T
Mockito matcher that matches anything, including nulls and varargs.
argumentCaptor fun <T : Any> argumentCaptor(): KArgumentCaptor<T>
Creates a KArgumentCaptor for given type.
createInstance fun <T : Any> createInstance(kClass: KClass<T>): T
eq fun <T> eq(value: T): T
Mockito matcher that matches if the argument is the same as the provided value.
expectException fun <T : Throwable> expectException(clazz: KClass<T>, block: () -> Unit): Unit
Expect block to throw an exception. Otherwise fail the test (junit).
mock fun <T : Any> mock(): T
Dynamically create a mock object. This method is helpful when creating mocks of classes using generics.
mockMotionEvent fun mockMotionEvent(action: Int, downTime: Long = System.currentTimeMillis(), eventTime: Long = System.currentTimeMillis(), x: Float = 0f, y: Float = 0f, metaState: Int = 0): MotionEvent
Creates a custom MotionEvent for testing. As of SDK 28 MotionEvents can’t be mocked anymore and need to be created through MotionEvent.obtain.