package net.pterodactylus.sone.test import com.google.inject.Module import org.mockito.ArgumentCaptor import org.mockito.Mockito import org.mockito.stubbing.OngoingStubbing inline fun mock(): T = Mockito.mock(T::class.java)!! inline fun mockBuilder(): T = Mockito.mock(T::class.java, Mockito.RETURNS_SELF)!! inline fun deepMock(): T = Mockito.mock(T::class.java, Mockito.RETURNS_DEEP_STUBS)!! inline fun capture(): ArgumentCaptor = ArgumentCaptor.forClass(T::class.java) inline fun bind(implementation: T): Module = Module { it!!.bind(T::class.java).toInstance(implementation) } inline fun bindMock(): Module = Module { it!!.bind(T::class.java).toInstance(mock()) } inline fun whenever(methodCall: T) = Mockito.`when`(methodCall) inline fun OngoingStubbing.thenReturnMock(): OngoingStubbing = this.thenReturn(mock())