doc / ch.tutteli.atrium.assertions.basic.contains.creators / ContainsObjectsAssertionCreator


abstract class ContainsObjectsAssertionCreator<T : Any, S, B : SearchBehaviour, C : Checker> : ContainsAssertionCreator<T, S, C>

Represents the base class for Contains.Creators which use bare objects as search criteria (matching them with ==).

It provides a template to fulfill the job of creating the sophisticated contains assertion.


T - The type of the AssertionPlant.subject. S - The type of the search criteria. B - The type of the current Contains.SearchBehaviour. C - The type of the checkers in use (typically a sub interface of Contains.Checker).



ContainsObjectsAssertionCreator(searchBehaviour: B, checkers: List<C>)

Represents the base class for Contains.Creators which use bare objects as search criteria (matching them with ==).



abstract val descriptionContains: Translatable

Provides the translation for contains.


abstract val descriptionNumberOfOccurrences: Translatable

Provides the translation for number of occurrences.



open fun createAssertionGroupForSearchCriteriaAssertions(assertions: List<Assertion>): AssertionGroup

Creates an AssertionGroup representing the sophisticated contains assertion as a whole based on the given assertions which where created for the search criteria.


abstract fun search(plant: AssertionPlant<T>, searchCriterion: S): Int

Searches for something matching the given searchCriterion in the given plant's subject and returns the number of occurrences.


fun searchAndCreateAssertion(plant: AssertionPlant<T>, searchCriterion: S, featureFactory: (Int, Translatable) -> AssertionGroup): AssertionGroup

Searches for something fulfilling the given searchCriterion in the given plant's subject and should pass on the number of occurrences to the given featureFactory which creates feature assertions based on the checkers, which in turn can be used to create a resulting AssertionGroup representing the assertion for a search criteria as a whole.



class CharSequenceContainsAssertionCreator<T : CharSequence, S : SearchBehaviour> : ContainsObjectsAssertionCreator<T, Any, S, Checker>, Creator<T, Any>

Represents a creator of sophisticated contains assertions for CharSequence.


class IterableContainsInAnyOrderObjectsAssertionCreator<S, T : Iterable<S>> : ContainsObjectsAssertionCreator<T, S, IterableContainsInAnyOrderSearchBehaviour, Checker>, Creator<T, S>

Represents a creator of a sophisticated contains assertions for Iterable where an expected entry can appear in any order and is identified by expected objects (equality comparison).