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

    299 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

    360 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

    254 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*

    313 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

    261 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

    315 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

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

    391 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

    224 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

    308 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...