Skip to content

Mocking

Markus Amshove edited this page Feb 21, 2016 · 1 revision

Mocking

This file contains examples on supported methods for mocking. All methods use Mockito.

Further examples can be seen in the tests

Setup a mock

val mock = mock(Database::class)

Verify that a method was called

mock.getPerson()
    Verify on mock that mock.getPerson() was called

Verify that no interactions happened

VerifyNoInteractions on mock

Verify no further interactions

mock.getPerson(1)
    mock.getPerson(5)
    Verify on mock that mock.getPerson(1) was called
    Verify on mock that mock.getPerson(5) was called
    VerifyNoFurtherInteractions on mock