Quick testing tips #6


Use Mockito verify to assert mock interactions




import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.verify
import org.junit.jupiter.api.Test

class Test {
  @Test
  fun `it should pass`() {
    val view: View = mock()
    verify(view).showLoading()
  }
}



Verify interactions on mocks created with Mockito - when you need to check if some action on given object was executed.



Read next:


Loading ...
Failed to load data.