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

ContainsObjectsAssertionCreator

abstract class ContainsObjectsAssertionCreator<T : Any, S, B : SearchBehaviour, C : Checker> : ContainsAssertionCreator<T, S, C> (source)
Deprecated: Please open an issue if you used this class; will be removed with 1.0.0

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.

Parameters

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

Constructors

<init>

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

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

Properties

descriptionContains

abstract val descriptionContains: Translatable

Provides the translation for contains.

descriptionNumberOfOccurrences

abstract val descriptionNumberOfOccurrences: Translatable

Provides the translation for number of occurrences.

Functions

createAssertionGroupForSearchCriteriaAssertions

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.

search

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.

searchAndCreateAssertion

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.

Inherited Functions

createAssertionGroup

fun createAssertionGroup(plant: AssertionPlant<T>, searchCriteria: List<S>): AssertionGroup

Creates an AssertionGroup representing the sophisticated contains assertion for the given plant based on the given searchCriteria.

fun createAssertionGroup(plant: AssertionPlant<T>, searchCriterion: S, otherSearchCriteria: Array<out S>): AssertionGroup

Inheritors

CharSequenceContainsAssertionCreator

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

Represents a creator of sophisticated contains assertions for CharSequence.

IterableContainsInAnyOrderObjectsAssertionCreator

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