Skip to content

appfoundry/mockito-kotlin

 
 

Repository files navigation

Forked from https://github.com/nhaarman/mockito-kotlin. Ported to Mockito 1 to support PowerMock!

Mockito1-Kotlin

A small library that provides helper functions to work with Mockito in Kotlin.

Example

A test using Mockito1-Kotlin typically looks like the following:

@Test
fun a(){ 
  /* Given */
  val mock = mock<MyClass> {
    on { getText() } doReturn "text"
  }
  val classUnderTest = ClassUnderTest(mock)
  
  /* When */
  classUnderTest.doAction()
  
  /* Then */
  verify(mock).doSomething(any())
}

About

Using Mockito with Kotlin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 100.0%