doc / ch.tutteli.atrium.logic.creating.charsequence.contains.creators.impl / CharSequenceContainsAssertionCreator

CharSequenceContainsAssertionCreator

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

Represents a creator of sophisticated contains assertions for CharSequence.

A sophisticated contains assertion is build up by a desired SearchBehaviour, a Searcher and a number of Checkers. The searcher searches for specified objects -- considering the given searchBehaviour -- and then passes on the result to the given checkers which in turn create the assertions representing the corresponding check. Those created assertions are then grouped into an AssertionGroup which represents the sophisticated assertion as a whole.

Parameters

T - The type of the subject for which the contains assertion is be build.

SC - The type of the search criteria.

S - The search behaviour which should be applied to the input of the search.

Constructors

<init>

CharSequenceContainsAssertionCreator(searchBehaviour: S, searcher: CharSequenceContains.Searcher<S, SC>, checkers: List<CharSequenceContains.Checker>, groupDescription: Translatable)

Represents a creator for sophisticated contains assertions for CharSequence.

Properties

descriptionContains

val descriptionContains: Translatable

Provides the translation for contains.

descriptionNotFound

val descriptionNotFound: Translatable

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

descriptionNumberOfElementsFound

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.

descriptionNumberOfOccurrences

val descriptionNumberOfOccurrences: Translatable

Provides the translation for number of occurrences.

descriptionToContain

val descriptionToContain: Translatable

Provides the translation for to contain.

groupDescription

val groupDescription: Translatable

Provides the translation for AssertionGroup.description

Functions

makeSubjectMultipleTimesConsumable

fun makeSubjectMultipleTimesConsumable(container: AssertionContainer<T>): AssertionContainer<String>

Make the underlying subject multiple times consumable.

search

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

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

Inherited 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

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.