doc / ch.tutteli.atrium.logic.creating.basic.contains.creators.impl / ContainsObjectsAssertionCreator

ContainsObjectsAssertionCreator

abstract class ContainsObjectsAssertionCreator<T : Any, TT : Any, in SC, S : Contains.SearchBehaviour, C : Contains.Checker> : ContainsAssertionCreator<T, TT, SC, C> (source)

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 subject of this expectation.

TT - The type of the subject of this expectation after making it multiple times consumable.

SC - The type of the search criteria.

S - 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: S, checkers: List<C>)

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

Properties

descriptionNumberOfOccurrences

abstract val descriptionNumberOfOccurrences: Translatable

Provides the translation for number of occurrences.

groupDescription

abstract val groupDescription: Translatable

Provides the translation for AssertionGroup.description

Inherited Properties

descriptionContains

abstract val descriptionContains: Translatable

Provides the translation for contains.

descriptionNotFound

abstract val descriptionNotFound: Translatable

Provides the translation for when an item is not found in a toContain.atLeast(1) check.

descriptionNumberOfElementsFound

abstract val descriptionNumberOfElementsFound: Translatable

Provides the translation for and N such elements were found when an item is not found in a toContain.atLeast(1) check.

descriptionToContain

abstract val descriptionToContain: Translatable

Provides the translation for to contain.

searchBehaviour

val searchBehaviour: Contains.SearchBehaviour

Functions

mismatchesForNotSearchBehaviour

open fun mismatchesForNotSearchBehaviour(multiConsumableContainer: AssertionContainer<TT>, searchCriterion: SC): List<Assertion>

Finds the mismatched indices and values when the searchBehaviour is NotSearchBehaviour in the subject of the given multiConsumableContainer and creates a list of assertions about the mismatched indexed values

search

abstract fun search(multiConsumableContainer: AssertionContainer<TT>, searchCriterion: SC): Int

Searches for something matching the given searchCriterion in the subject of the given multiConsumableContainer and returns the number of occurrences.

searchAndCreateAssertion

open fun searchAndCreateAssertion(multiConsumableContainer: AssertionContainer<TT>, searchCriterion: SC, featureFactory: (Int, Translatable) -> AssertionGroup): AssertionGroup

Searches for something fulfilling the given searchCriterion in the subject of this expectation associated with the given multiConsumableContainer 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(container: AssertionContainer<T>, searchCriteria: List<SC>): AssertionGroup

Creates an AssertionGroup representing the sophisticated contains assertion for the subject of the given container, based on the given searchCriteria.

decorateInAnyOrderAssertion

open fun decorateInAnyOrderAssertion(inAnyOrderAssertion: AssertionGroup, multiConsumableContainer: AssertionContainer<TT>): AssertionGroup

Override in a subclass if you want to decorate the assertion.

makeSubjectMultipleTimesConsumable

abstract fun makeSubjectMultipleTimesConsumable(container: AssertionContainer<T>): AssertionContainer<TT>

Make the underlying subject multiple times consumable.

Inheritors

CharSequenceContainsAssertionCreator

class CharSequenceContainsAssertionCreator<T : CharSequence, in SC : Any, S : CharSequenceContains.SearchBehaviour> : ContainsObjectsAssertionCreator<T, String, SC, S, CharSequenceContains.Checker>, CharSequenceContains.Creator<T, SC>

Represents a creator of sophisticated contains assertions for CharSequence.

InAnyOrderValuesAssertionCreator

class InAnyOrderValuesAssertionCreator<SC, T> : ContainsObjectsAssertionCreator<T, List<SC>, SC, InAnyOrderSearchBehaviour, IterableLikeContains.Checker>, IterableLikeContains.Creator<T, SC>

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