move TODOs to 0.15.0 for AssertionCollector, implFactories, core and...

- MetaFeatureOption
- no longer extending SubjectProvider in AssertionContainer
- creating a Helper to change the representation of a FeatureExpect on
  the logic level
This commit is contained in:
Robert Stoll
2020-11-13 21:40:02 +01:00
parent 45af103ee2
commit 5e04d636a8
10 changed files with 13 additions and 9 deletions

View File

@@ -34,5 +34,6 @@ interface HoldsStep<R> {
*
* @return `true` in case [SubjectProvider.maybeSubject] is None or the result of [test] passing the subject.
*/
//TODO move to logic and expect AssertionContainer with 0.15.0
fun <T> withTest(subjectProvider: SubjectProvider<T>, test: (T) -> Boolean): R
}

View File

@@ -42,6 +42,7 @@ interface Descriptive {
* fun <T> withTest(expect: Expect, test: (T) -> Boolean): DescriptionOption<FinalStep>
* ```
*/
//TODO move to logic and expect AssertionContainer with 0.15.0
fun <T> withTest(subjectProvider: SubjectProvider<T>, test: (T) -> Boolean): DescriptionOption<FinalStep>
companion object {

View File

@@ -33,6 +33,7 @@ fun Descriptive.DescriptionOption<Descriptive.FinalStep>.withFailureHint(
* Or use [withFailureHint] which does not expect a [subjectProvider] in case your [DescriptiveAssertion] is not based
* on the subject of the assertion.
*/
//TODO move to logic and expect AssertionContainer with 0.15.0
fun <T> Descriptive.DescriptionOption<Descriptive.FinalStep>.withFailureHintBasedOnDefinedSubject(
subjectProvider: SubjectProvider<T>,
failureHintFactory: (T) -> Assertion

View File

@@ -14,9 +14,9 @@ import kotlin.reflect.KClass
* Note, do not use [SubjectProvider] as this interface is only temporary and will most likely be removed without
* further notice.
*
* @param T The type of the [subject] of the assertion.
* @param T The type of the subject of the assertion.
*/
//TODO 0.14.0 remove SubjectProvider
//TODO 0.15.0 remove SubjectProvider
interface AssertionContainer<T> : SubjectProvider<T> {
override val maybeSubject: Option<T>

View File

@@ -22,7 +22,7 @@ abstract class BaseExpectImpl<T>(
override val maybeSubject: Option<T>
) : ExpectInternal<T> {
// TODO 0.14.0 not every expect should have an own implFactories but only the root,
// TODO 0.15.0 not every expect should have an own implFactories but only the root,
// maybe also FeatureExpect but surely not DelegatingExpect or CollectingExpect
private val implFactories: MutableMap<KClass<*>, (() -> Nothing) -> () -> Any> = mutableMapOf()

View File

@@ -4,6 +4,6 @@ package ch.tutteli.atrium.core.robstoll
* Dummy function in order that other modules can define a dependency on atrium-core-robstoll-js
*/
@Suppress("FunctionName")
//TODO 0.14.0 deprecated if core-robstoll is deprecated
//TODO 0.15.0 deprecated if core-robstoll is deprecated
fun dependOn_atrium_core_robstoll() {
}

View File

@@ -20,7 +20,7 @@ class DefaultThrowableAssertions : ThrowableAssertions {
expectedType: KClass<TExpected>
): SubjectChangerBuilder.ExecutionStep<Throwable?, TExpected> =
container.manualFeature(OCCURRED_EXCEPTION_CAUSE) { cause }.transform().let { previousExpect ->
//TODO 0.14.0 factor out a pattern, we are doing this more than once, in API we have withOptions
//TODO 0.15.0 factor out a pattern, we are doing this more than once, in API we have withOptions
FeatureExpect(
previousExpect,
FeatureExpectOptions(representationInsteadOfFeature = {

View File

@@ -17,12 +17,13 @@ import ch.tutteli.atrium.reporting.translating.Translatable
*
* It loads the implementation lazily via [loadSingleService].
*/
//TODO 0.15.0 move to atrium-logic
val assertionCollector: AssertionCollector by lazy { loadSingleService(AssertionCollector::class) }
/**
* Responsible to collect assertions made in an `assertionCreator`-lambda.
*/
//TODO 0.14.0 move to atrium-logic
//TODO 0.15.0 move to atrium-logic
interface AssertionCollector {
/**

View File

@@ -115,7 +115,7 @@ object NewFeatureAssertionsBuilder : NewFeatureAssertions {
* a function which expects 2 arguments).
*/
//TODO move to API, this could potentially be different per API
//TODO deprecate in 0.14.0
//TODO deprecate in 0.15.0
class MetaFeatureOption<T>(private val expect: Expect<T>) {
/**

View File

@@ -10,7 +10,7 @@ import ch.tutteli.atrium.domain.creating.collectors.assertionCollector
/**
* Collects the assertions [assertionCreator] creates and uses them as [AssertionGroup.assertions].
*/
//TODO move to atrium-logic with 0.14.0
//TODO move to atrium-logic with 0.15.0
fun <T, G : ExplanatoryAssertionGroupType, R> AssertionsOption<G, R>.collectAssertions(
expect: Expect<T>,
assertionCreator: Expect<T>.() -> Unit
@@ -19,7 +19,7 @@ fun <T, G : ExplanatoryAssertionGroupType, R> AssertionsOption<G, R>.collectAsse
/**
* Collects the assertions [assertionCreator] creates and uses them as [AssertionGroup.assertions].
*/
//TODO move to atrium-logic with 0.14.0
//TODO move to atrium-logic with 0.15.0
fun <T, G : ExplanatoryAssertionGroupType, R> AssertionsOption<G, R>.collectAssertions(
maybeSubject: Option<T>,
assertionCreator: Expect<T>.() -> Unit