main.kotlin.ch.tutteli.atrium.logic.logicIterableLikeContains.kt Maven / Gradle / Ivy
@file:Suppress("ObjectPropertyName", "FunctionName")
package ch.tutteli.atrium.logic
import ch.tutteli.atrium.assertions.Assertion
import ch.tutteli.atrium.creating.Expect
import ch.tutteli.atrium.logic.creating.iterable.contains.IterableLikeContains
import ch.tutteli.atrium.logic.creating.iterable.contains.steps.WithTimesCheckerStep
import ch.tutteli.atrium.logic.creating.iterable.contains.steps.WithTimesCheckerStepInternal
import ch.tutteli.atrium.logic.creating.iterable.contains.steps.WithTimesCheckerStepLogic
import ch.tutteli.atrium.reporting.BUG_REPORT_URL
/**
* Appends the [Assertion] the given [factory] creates based on this [IterableLikeContains.EntryPointStep].
*
* Use [_logic] for more sophisticated scenarios.
*/
inline fun
IterableLikeContains.EntryPointStep._logicAppend(
factory: IterableLikeContains.EntryPointStepLogic.() -> Assertion
): Expect = _logic.let { l -> l.container.append(l.factory()) }
/**
* Entry point to the logic level of Atrium -- which is one level deeper than the API --
* within the building process of a sophisticated `contains` assertion for [Iterable].
*/
inline val
IterableLikeContains.EntryPointStep._logic: IterableLikeContains.EntryPointStepLogic
get() = when (this) {
is IterableLikeContains.EntryPointStepInternal -> this
else -> throw UnsupportedOperationException("Unsupported IterableLikeContains.Builder: $this -- please open an issue that a hook shall be implemented: $BUG_REPORT_URL?template=feature_request&title=Hook%20for%20IterableLikeContains.EntryPointStep._logic")
}
/**
* Entry point to the logic level of Atrium -- which is one level deeper than the API --
* within the building process of a sophisticated `contains` assertion for [Iterable].
*
* Use [_logicAppend] in case you want to create and append an [Assertion] to the initial [Expect].
*/
inline val
WithTimesCheckerStep._logic: WithTimesCheckerStepLogic
get() = when (this) {
is WithTimesCheckerStepInternal -> this
else -> throw UnsupportedOperationException("Unsupported WithTimesCheckerStep: $this -- please open an issue that a hook shall be implemented: $BUG_REPORT_URL?template=feature_request&title=Hook%20for%20IterableLikeContains%20WithTimesCheckerStep._logic")
}
/**
* Appends the [Assertion] the given [factory] creates based on this [IterableLikeContains.CheckerStep].
*
* Use [_logic] for more sophisticated scenarios.
*/
inline fun
IterableLikeContains.CheckerStep._logicAppend(
factory: IterableLikeContains.CheckerStepLogic.() -> Assertion
): Expect = _logic.let { l -> l.entryPointStepLogic.container.append(l.factory()) }
/**
* Entry point to the logic level of Atrium -- which is one level deeper than the API --
* within the building process of a sophisticated `contains` assertion for [Iterable].
*
* Use [_logicAppend] in case you want to create and append an [Assertion] to the initial [Expect].
*/
inline val
IterableLikeContains.CheckerStep._logic: IterableLikeContains.CheckerStepLogic
get() = when (this) {
is IterableLikeContains.CheckerStepInternal -> this
else -> throw UnsupportedOperationException("Unsupported IterableLikeContains.CheckerStep: $this -- please open an issue that a hook shall be implemented: $BUG_REPORT_URL?template=feature_request&title=Hook%20for%20IterableLikeContains.CheckerStep._logic")
}