android-components / / CollectionProcessor / withFactCollection


fun withFactCollection(block: (List<Fact>) -> Unit): Unit (source)

Helper for creating a CollectionProcessor, registering it and clearing the processors again.

Use in tests like:

CollectionProcessor.withFactCollection { facts ->
  // During execution of this block the "facts" list will be updated automatically to contain
  // all facts that were emitted while executing this block.
  // After this block has completed all registered processors will be cleared.