teller-android / com.levibostian.teller.testing.repository / OnlineRepositoryTesting

OnlineRepositoryTesting

class OnlineRepositoryTesting

Used for testing purposes to initialize the state of a OnlineRepository subclass instance.

You can use this class directly, or, use the recommended extension functions in the OnlineRepository.Testing object.

Intentions of OnlineRepositoryTesting:

  1. Be able to initialize the state of an OnlineRepository state with 1 line of code.
  2. Be utility for integration testing purposes when an OnlineRepository is interacting with non-mocked instances of objects.
  3. Populate a new value for cache and last fetched time if a cache has been fetched before. However, it is also assumed that in your test setup you have cleared Teller data and all of your cache data so the test is running on a clean slate. This class does not delete data for you, it only provides new values.

Types

CacheExistsDsl

class CacheExistsDsl

SetValues

data class SetValues

The values set in one of the OnlineRepositoryTesting init functions.

StateOfOnlineRepositoryDsl

class StateOfOnlineRepositoryDsl<CACHE>

Functions

initState

fun <CACHE, REQ : GetCacheRequirements, FETCH_RESPONSE> initState(repository: OnlineRepository<CACHE, REQ, FETCH_RESPONSE>, requirements: REQ, more: StateOfOnlineRepositoryDsl<FETCH_RESPONSE>.() -> Unit = null): SetValues

initStateAsync

fun <CACHE, REQ : GetCacheRequirements, FETCH_RESPONSE> initStateAsync(repository: OnlineRepository<CACHE, REQ, FETCH_RESPONSE>, requirements: REQ, more: StateOfOnlineRepositoryDsl<FETCH_RESPONSE>.() -> Unit = null, complete: (SetValues) -> Unit): Unit

Companion Object Functions

initState

fun <CACHE, REQ : GetCacheRequirements, FETCH_RESPONSE> initState(repository: OnlineRepository<CACHE, REQ, FETCH_RESPONSE>, requirements: REQ, more: StateOfOnlineRepositoryDsl<FETCH_RESPONSE>.() -> Unit = null): SetValues

initStateAsync

fun <CACHE, REQ : GetCacheRequirements, FETCH_RESPONSE> initStateAsync(repository: OnlineRepository<CACHE, REQ, FETCH_RESPONSE>, requirements: REQ, more: StateOfOnlineRepositoryDsl<FETCH_RESPONSE>.() -> Unit = null, complete: (SetValues) -> Unit): Unit