书栈网 · BookStack 本次搜索耗时 0.013 秒,为您找到 29 个相关结果.
  • Why MockK

    377 2021-11-12 《MockK Guidebook》
    Why MockK Why MockK MockK is a mocking framework built in Kotlin to be used with Kotlin programs. Because MockK is written in Kotlin, it has first-class support for Kotlin langu...
  • Verify that functions were called

    504 2021-11-12 《MockK Guidebook》
    Verify that functions were called Verifying dependencies Verifying that any mock functions is never called Verifying that a function is never called Verifying a function is call...
  • Tips

    352 2021-11-12 《MockK Guidebook》
    Tips Tips In this section we present a number of tips that we have collected over the course of using MockK in the real world. Chains Exclude Timeout Timeouts # Return `...
  • when and do*

    389 2021-11-12 《MockK Guidebook》
    when and do* thenReturn /doReturn thenThrow /doThrow doNothing thenAnswer /then /doAnswer Consecutive calls Coroutines when and do* Mockito provides two similar ap...
  • Create many mocks quickly with annotations

    351 2021-11-12 《MockK Guidebook》
    Create many mocks quickly with annotations Options Spies Create many mocks quickly with annotations Sometimes you will need to create many mocks in your test class. As each mo...
  • Create a mock

    439 2021-11-12 《MockK Guidebook》
    Create a mock Create a mock The syntax to create a mock is very similar in Mockito and MockK. However, the behaviour is slightly different. // Mockito val mockedFile = mock...
  • verify

    427 2021-11-12 《MockK Guidebook》
    verify Verification Mode never atLeast /atLeastOnce atMost /atMostOnce times timeout verifyNoInteractions verifyNoMoreInteractions Coroutines verify Verifying ...
  • Stub out behaviour

    521 2021-11-12 《MockK Guidebook》
    Stub out behaviour Stub out behaviour Your Kotlin classes often depends on other objects and functions when running. When you are writing tests for your classes, you only want t...
  • Assertions with an argument

    294 2021-11-12 《MockK Guidebook》
    Run assertions with an argument Arrays and data classes Nullable arguments Coroutines Run assertions with an argument There are some special argument matchers that can only b...
  • Automatically stub by relaxing

    379 2021-11-12 《MockK Guidebook》
    Automatically stub by relaxing Automatically stub by relaxing If a method has not been stubbed, MockK will throw an error if it is called. This is designed to help make your tes...