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

ContainsObjectsAssertionCreator

abstract class ContainsObjectsAssertionCreator<T : Any, S, B : ISearchBehaviour, C : IChecker> : ContainsAssertionCreator<T, S, C>

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

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

Parameters

T - The type of the IAssertionPlant.subject. S - The type of the search criteria. B - The type of the current IContains.ISearchBehaviour. C - The type of the checkers in use (typically a sub interface of IContains.IChecker).

Constructors

<init>

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

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

Properties

descriptionContains

abstract val descriptionContains: ITranslatable

Provides the translation for contains.

descriptionNumberOfOccurrences

abstract val descriptionNumberOfOccurrences: ITranslatable

Provides the translation for number of occurrences.

Functions

createAssertionGroupForSearchCriteriaAssertions

open fun createAssertionGroupForSearchCriteriaAssertions(assertions: List<IAssertion>): IAssertionGroup

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

search

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

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

searchAndCreateAssertion

fun searchAndCreateAssertion(plant: IAssertionPlant<T>, searchCriterion: S, featureFactory: (Int, ITranslatable) -> IAssertionGroup): IAssertionGroup

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 IAssertionGroup representing the assertion for a search criteria as a whole.

Inheritors

CharSequenceContainsAssertionCreator

class CharSequenceContainsAssertionCreator<T : CharSequence, S : ISearchBehaviour> : ContainsObjectsAssertionCreator<T, Any, S, IChecker>, ICreator<T, Any>

Represents a creator of sophisticated contains assertions for CharSequence.

IterableContainsInAnyOrderObjectsAssertionCreator

class IterableContainsInAnyOrderObjectsAssertionCreator<S, T : Iterable<S>> : ContainsObjectsAssertionCreator<T, S, IterableContainsInAnyOrderSearchBehaviour, IChecker>, ICreator<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).