diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml
index 77ef903a8..6f9c192f7 100644
--- a/.github/workflows/build-ubuntu.yml
+++ b/.github/workflows/build-ubuntu.yml
@@ -20,7 +20,7 @@ jobs:
- name: build
run: ./gradlew build
- # TODO 0.17.0 or 0.18.0 re-activate scala API
+ # TODO 0.18.0 re-activate scala API
# - name: composite build atrium-scala2
# run: ./gradlew build
# working-directory: misc/tools/atrium-scala2-test
diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml
index 87d5b9f38..fc558145c 100644
--- a/.github/workflows/build-windows.yml
+++ b/.github/workflows/build-windows.yml
@@ -47,7 +47,7 @@ jobs:
run: ATRIUM_ANDROID_JAR="$PWD/android-jar-cache/android.jar" ./gradlew checkDexer
shell: bash
- # TODO 0.17.0 or 0.18.0 re-activate scala API
+ # TODO 0.18.0 re-activate scala API
# - name: composite build atrium-scala2
# run: ./gradlew build
# working-directory: misc\tools\atrium-scala2-test
diff --git a/README.md b/README.md
index 8e5e5365b..8a1f15bb4 100644
--- a/README.md
+++ b/README.md
@@ -2000,8 +2000,10 @@ This is kind of the simplest way of defining assertion functions. Following an e
```kotlin
+import ch.tutteli.atrium.logic._logic
+
fun Expect.isMultipleOf(base: Int) =
- createAndAddAssertion("is multiple of", base) { it % base == 0 }
+ _logic.createAndAppendAssertion("is multiple of", base) { it % base == 0 }
```
@@ -2012,7 +2014,7 @@ and its usage:
```kotlin
expect(12).isMultipleOf(5)
```
-↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L39) ↓ [Output](#ex-own-boolean-1)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L44) ↓ [Output](#ex-own-boolean-1)
```text
expected that subject: 12 (kotlin.Int <1234789>)
@@ -2048,8 +2050,10 @@ Consider the following assertion function:
```kotlin
+import ch.tutteli.atrium.logic._logic
+
fun Expect.isEven() =
- createAndAddAssertion("is", Text("an even number")) { it % 2 == 0 }
+ _logic.createAndAppendAssertion("is", Text("an even number")) { it % 2 == 0 }
```
@@ -2062,7 +2066,7 @@ Its usage looks then as follows:
```kotlin
expect(13).isEven()
```
-↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L50) ↓ [Output](#ex-own-boolean-2)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L57) ↓ [Output](#ex-own-boolean-2)
```text
expected that subject: 13 (kotlin.Int <1234789>)
@@ -2095,8 +2099,10 @@ if you want that both are evaluated:
```kotlin
+import ch.tutteli.atrium.logic._logic
+
fun Expect.isBetween(lowerBoundInclusive: T, upperBoundExclusive: T) =
- addAssertionsCreatedBy {
+ _logic.appendAssertionsCreatedBy {
isGreaterThanOrEqual(lowerBoundInclusive)
isLessThan(upperBoundExclusive)
}
@@ -2161,7 +2167,7 @@ Its usage is then as follows:
expect(Person("Susanne", "Whitley", 43, listOf()))
.hasNumberOfChildren(2)
```
-↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L67) ↓ [Output](#ex-own-compose-3)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L74) ↓ [Output](#ex-own-compose-3)
```text
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[]) (readme.examples.Person <1234789>)
@@ -2195,7 +2201,7 @@ but we do not have to, as `all` already checks that there is at least one elemen
expect(Person("Susanne", "Whitley", 43, listOf()))
.hasAdultChildren()
```
-↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L82) ↓ [Output](#ex-own-compose-4)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L89) ↓ [Output](#ex-own-compose-4)
```text
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[]) (readme.examples.Person <1234789>)
@@ -2237,7 +2243,7 @@ expect(Person("Susanne", "Whitley", 43, listOf(Person("Petra", "Whitley", 12, li
.children // using the val -> subsequent assertions are about children and fail fast
.hasSize(2)
```
-↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L92) ↓ [Output](#ex-own-compose-5)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L99) ↓ [Output](#ex-own-compose-5)
```text
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[Person(firstName=Petra, lastName=Whitley, age=12, children=[])]) (readme.examples.Person <1234789>)
@@ -2458,8 +2464,13 @@ we do no longer use a `String` but a proper `Translatable`.
```kotlin
-fun Expect.isMultipleOf(base: Int): Expect =
- createAndAddAssertion(DescriptionIntAssertion.IS_MULTIPLE_OF, base) { it % base == 0 }
+import ch.tutteli.atrium.logic.*
+
+fun Expect.isMultipleOf(base: Int): Expect = _logic.run {
+ appendAssertion(
+ createDescriptiveAssertion(DescriptionIntAssertion.IS_MULTIPLE_OF, base) { it % base == 0 }
+ )
+}
enum class DescriptionIntAssertion(override val value: String) : StringBasedTranslatable {
IS_MULTIPLE_OF("is multiple of")
@@ -2505,8 +2516,13 @@ as second example:
```kotlin
-fun Expect.isEven(): Expect =
- createAndAddAssertion(DescriptionBasic.IS, DescriptionIntAssertions.EVEN) { it % 2 == 0 }
+import ch.tutteli.atrium.logic.*
+
+fun Expect.isEven(): Expect = _logic.run {
+ appendAssertion(
+ createDescriptiveAssertion(DescriptionBasic.IS, DescriptionIntAssertions.EVEN) { it % 2 == 0 }
+ )
+}
enum class DescriptionIntAssertions(override val value: String) : StringBasedTranslatable {
EVEN("an even number")
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/anyAssertions.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/anyAssertions.kt
index 3c414d984..92154113e 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/anyAssertions.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/anyAssertions.kt
@@ -193,7 +193,7 @@ inline val Expect.and: Expect get() = this
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.deprecated.AnyAssertionSamples.and
*/
infix fun Expect.and(assertionCreator: Expect.() -> Unit): Expect =
- addAssertionsCreatedBy(assertionCreator)
+ _logic.appendAssertionsCreatedBy(assertionCreator)
/**
* Expects that the subject of `this` expectation is not (equal to) [expected] and [otherValues].
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/arrayAssertions.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/arrayAssertions.kt
index a91a6d0f3..d4d5f2d49 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/arrayAssertions.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/arrayAssertions.kt
@@ -34,7 +34,7 @@ fun Expect>.asList(): Expect> =
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.deprecated.ArrayAssertionSamples.asList
*/
fun Expect>.asList(assertionCreator: Expect>.() -> Unit): Expect> =
- apply { asList().addAssertionsCreatedBy(assertionCreator) }
+ apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
* Expects that the subject of `this` expectation holds all assertions the given [assertionCreator] creates for
@@ -51,7 +51,7 @@ fun Expect>.asList(assertionCreator: Expect>.() -> Unit): E
*/
@JvmName("asListEOut")
fun Expect>.asList(assertionCreator: Expect>.() -> Unit): Expect> =
- apply { asList().addAssertionsCreatedBy(assertionCreator) }
+ apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
* Turns `Expect` into `Expect>`.
@@ -84,7 +84,7 @@ fun Expect.asList(): Expect> =
*/
@JvmName("byteArrAsList")
fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList().addAssertionsCreatedBy(assertionCreator) }
+ apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -118,7 +118,7 @@ fun Expect.asList(): Expect> =
*/
@JvmName("charArrAsList")
fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList().addAssertionsCreatedBy(assertionCreator) }
+ apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -152,7 +152,7 @@ fun Expect.asList(): Expect> =
*/
@JvmName("shortArrAsList")
fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList().addAssertionsCreatedBy(assertionCreator) }
+ apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -186,7 +186,7 @@ fun Expect.asList(): Expect> =
*/
@JvmName("intArrAsList")
fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList().addAssertionsCreatedBy(assertionCreator) }
+ apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -220,7 +220,7 @@ fun Expect.asList(): Expect> =
*/
@JvmName("longArrAsList")
fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList().addAssertionsCreatedBy(assertionCreator) }
+ apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -254,7 +254,7 @@ fun Expect.asList(): Expect> =
*/
@JvmName("floatArrAsList")
fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList().addAssertionsCreatedBy(assertionCreator) }
+ apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -288,7 +288,7 @@ fun Expect.asList(): Expect> =
*/
@JvmName("doubleArrAsList")
fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList().addAssertionsCreatedBy(assertionCreator) }
+ apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -321,4 +321,4 @@ fun Expect.asList(): Expect> =
*/
@JvmName("boolArrAsList")
fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList().addAssertionsCreatedBy(assertionCreator) }
+ apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableAssertions.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableAssertions.kt
index 0e30b073e..3cc4e78f2 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableAssertions.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableAssertions.kt
@@ -337,4 +337,4 @@ fun > Expect.asList(): Expect> = _logic.changeSubj
* @since 0.14.0
*/
fun > Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList().addAssertionsCreatedBy(assertionCreator) }
+ apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/mapAssertions.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/mapAssertions.kt
index b7801b456..56e578bbd 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/mapAssertions.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/mapAssertions.kt
@@ -236,7 +236,7 @@ fun > Expect.asEntries(): Expect>
*/
fun > Expect.asEntries(
assertionCreator: Expect>>.() -> Unit
-): Expect = apply { asEntries().addAssertionsCreatedBy(assertionCreator) }
+): Expect = apply { asEntries()._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
* Expects that the subject of `this` expectation (a [Map]) is an empty [Map].
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/sequenceAssertions.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/sequenceAssertions.kt
index df28efca3..dae8baf0b 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/sequenceAssertions.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/sequenceAssertions.kt
@@ -25,7 +25,7 @@ fun > Expect.asIterable(): Expect> =
* @return an [Expect] for the subject of `this` expectation.
*/
fun > Expect.asIterable(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asIterable().addAssertionsCreatedBy(assertionCreator) }
+ apply { asIterable()._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
* Turns `Expect>` into `Expect`.
@@ -51,4 +51,4 @@ fun > Expect.asList(): Expect> = _logic.changeSubj
* @since 0.14.0
*/
fun > Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList().addAssertionsCreatedBy(assertionCreator) }
+ apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableAnyExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableAnyExpectationsSpec.kt
index d1419d96b..ccf0a6c0a 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableAnyExpectationsSpec.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableAnyExpectationsSpec.kt
@@ -27,7 +27,7 @@ class IterableAnyExpectationsSpec : Spek({
"[Atrium][Builder] "
)
- // TODO 0.17.0 #722 this will differ once we don't implement the same behaviour for contains and none
+ // TODO 0.19.0 #722 this will differ once we don't implement the same behaviour for contains and none
// that's fine and we can simply remove this test here
object ShortcutSpec : ch.tutteli.atrium.specs.integration.IterableAnyExpectationsSpec(
shortcutDescription to C::containsEntryShortcut,
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableNoneExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableNoneExpectationsSpec.kt
index b4fde3183..37ccb8d1c 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableNoneExpectationsSpec.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableNoneExpectationsSpec.kt
@@ -17,7 +17,7 @@ class IterableNoneExpectationsSpec : Spek({
"[Atrium][Predicate] "
)
- // TODO 0.17.0 #722 this will differ once we don't implement the same behaviour for contains and none
+ // TODO 0.19.0 #722 this will differ once we don't implement the same behaviour for contains and none
// that's fine and we can simply remove this test here
object BuilderSpec : ch.tutteli.atrium.specs.integration.IterableNoneExpectationsSpec(
functionDescription to C::containsNotFun,
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/fileAssertions.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/fileAssertions.kt
index 4a17eed18..020dddd2f 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/fileAssertions.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/fileAssertions.kt
@@ -36,4 +36,4 @@ fun Expect.asPath(): Expect =
* @since 0.9.0
*/
fun Expect.asPath(assertionCreator: Expect.() -> Unit): Expect =
- apply { asPath().addAssertionsCreatedBy(assertionCreator) }
+ apply { asPath()._logic.appendAssertionsCreatedBy(assertionCreator) }
diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/anyAssertions.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/anyAssertions.kt
index f90263a85..b9eabca96 100644
--- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/anyAssertions.kt
+++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/anyAssertions.kt
@@ -194,7 +194,7 @@ inline infix fun Expect.and(@Suppress("UNUSED_PARAMETER") o: o): Expect Expect.and(assertionCreator: Expect.() -> Unit): Expect =
- addAssertionsCreatedBy(assertionCreator)
+ _logic.appendAssertionsCreatedBy(assertionCreator)
/**
* Inline property referring actually to `this` and allows to write infix assertions within an assertion group block
diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/arrayAssertions.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/arrayAssertions.kt
index 5565530b6..08cf186fe 100644
--- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/arrayAssertions.kt
+++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/arrayAssertions.kt
@@ -34,7 +34,7 @@ infix fun Expect>.asList(@Suppress("UNUSED_PARAMETER") o: o
* @since 0.12.0
*/
infix fun Expect>.asList(assertionCreator: Expect>.() -> Unit): Expect> =
- apply { asList(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
* Expects that the subject of `this` expectation holds all assertions the given [assertionCreator] creates for
@@ -51,7 +51,7 @@ infix fun Expect>.asList(assertionCreator: Expect>.() -> Un
*/
@JvmName("asListEOut")
infix fun Expect>.asList(assertionCreator: Expect>.() -> Unit): Expect> =
- apply { asList(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
* Turns `Expect` into `Expect>`.
@@ -84,7 +84,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -118,7 +118,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -152,7 +152,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect<
*/
@JvmName("shortArrAsList")
infix fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -186,7 +186,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -220,7 +220,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -254,7 +254,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect<
*/
@JvmName("floatArrAsList")
infix fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -288,7 +288,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect
*/
@JvmName("doubleArrAsList")
infix fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
@@ -322,4 +322,4 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expec
*/
@JvmName("boolArrAsList")
infix fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/iterableAssertions.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/iterableAssertions.kt
index 8efada6c6..6eee6d1eb 100644
--- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/iterableAssertions.kt
+++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/iterableAssertions.kt
@@ -385,4 +385,4 @@ infix fun > Expect.asList(
* @since 0.14.0
*/
infix fun > Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/mapAssertions.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/mapAssertions.kt
index 454617956..552d17516 100644
--- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/mapAssertions.kt
+++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/mapAssertions.kt
@@ -292,7 +292,7 @@ infix fun > Expect.asEntries(
*/
infix fun > Expect.asEntries(
assertionCreator: Expect>>.() -> Unit
-): Expect = apply { asEntries(o).addAssertionsCreatedBy(assertionCreator) }
+): Expect = apply { asEntries(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
* Expects that the subject of `this` expectation (a [Map]) is an empty [Map].
diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/sequenceAssertions.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/sequenceAssertions.kt
index b989727c9..06919ddb0 100644
--- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/sequenceAssertions.kt
+++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/sequenceAssertions.kt
@@ -26,7 +26,7 @@ infix fun > Expect.asIterable(
* @return an [Expect] for the subject of `this` expectation.
*/
infix fun > Expect.asIterable(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asIterable(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asIterable(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
/**
* Turns `Expect>` into `Expect`.
@@ -54,4 +54,4 @@ infix fun > Expect.asList(
* @since 0.14.0
*/
infix fun > Expect.asList(assertionCreator: Expect>.() -> Unit): Expect =
- apply { asList(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/fileAssertions.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/fileAssertions.kt
index 58833c508..8f3ad5b5b 100644
--- a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/fileAssertions.kt
+++ b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/fileAssertions.kt
@@ -36,4 +36,4 @@ infix fun Expect.asPath(@Suppress("UNUSED_PARAMETER") o: o): Expec
* @since 0.12.0
*/
infix fun Expect.asPath(assertionCreator: Expect.() -> Unit): Expect =
- apply { asPath(o).addAssertionsCreatedBy(assertionCreator) }
+ apply { asPath(o)._logic.appendAssertionsCreatedBy(assertionCreator) }
diff --git a/build.gradle b/build.gradle
index 6431be3c3..655738ae4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -334,7 +334,7 @@ def createJsTestTask(String... subprojectNames) {
from compileKotlin2Js.destinationDir
prefixedProject('verbs-internal-js').afterEvaluate {
- // TODO 0.17.0 or 0.18.0, check if still required with the new Kotlin MPP plugin
+ // TODO 0.18.0, check if still required with the new Kotlin MPP plugin
configurations.testRuntimeClasspath.allDependencies.withType(ProjectDependency).each {
dependsOn(it.dependencyProject.assemble)
}
diff --git a/bundles/fluent-en_GB/atrium-fluent-en_GB-common/src/test/kotlin/SmokeTest.kt b/bundles/fluent-en_GB/atrium-fluent-en_GB-common/src/test/kotlin/SmokeTest.kt
index 2806a5390..aa74ec175 100644
--- a/bundles/fluent-en_GB/atrium-fluent-en_GB-common/src/test/kotlin/SmokeTest.kt
+++ b/bundles/fluent-en_GB/atrium-fluent-en_GB-common/src/test/kotlin/SmokeTest.kt
@@ -9,6 +9,7 @@ import ch.tutteli.atrium.api.verbs.expect
import ch.tutteli.atrium.assertions.Assertion
import ch.tutteli.atrium.creating.AssertionContainer
import ch.tutteli.atrium.creating.Expect
+import ch.tutteli.atrium.logic._logic
import ch.tutteli.atrium.logic._logicAppend
import ch.tutteli.atrium.logic.createDescriptiveAssertion
import ch.tutteli.atrium.reporting.Text
@@ -26,6 +27,7 @@ class SmokeTest {
@Test
fun assertionFunctionWithoutI18nCanBeUsed() {
assertThat(2).isEven()
+ assertThat(1).isOdd()
}
@Test
@@ -106,8 +108,11 @@ class SmokeTest {
}
}
-//TODO 0.17.0 also add test case for using the string overload once we have createAndAppend
-fun Expect.isEven() = createAndAddAssertion(IS, Text("an even number")) { it % 2 == 0 }
+fun Expect.isEven() =
+ _logic.createAndAppendAssertion("is", Text("an even number")) { it % 2 == 0 }
+
+fun Expect.isOdd() =
+ _logic.appendAssertion(_logic.createDescriptiveAssertion(IS, Text("an odd number")) { it % 2 == 1 })
fun Expect.isMultipleOf(base: Int): Expect = _logicAppend { isMultipleOf(base) }
diff --git a/bundles/fluent-en_GB/atrium-fluent-en_GB-jvm/src/test/kotlin/custom/SmokeSpec.kt b/bundles/fluent-en_GB/atrium-fluent-en_GB-jvm/src/test/kotlin/custom/SmokeSpec.kt
index 557992a3f..d7dd7d31f 100644
--- a/bundles/fluent-en_GB/atrium-fluent-en_GB-jvm/src/test/kotlin/custom/SmokeSpec.kt
+++ b/bundles/fluent-en_GB/atrium-fluent-en_GB-jvm/src/test/kotlin/custom/SmokeSpec.kt
@@ -7,6 +7,7 @@ import ch.tutteli.atrium.api.verbs.assertThat
import ch.tutteli.atrium.assertions.Assertion
import ch.tutteli.atrium.creating.AssertionContainer
import ch.tutteli.atrium.creating.Expect
+import ch.tutteli.atrium.logic._logic
import ch.tutteli.atrium.logic._logicAppend
import ch.tutteli.atrium.logic.createDescriptiveAssertion
import ch.tutteli.atrium.reporting.Text
@@ -26,6 +27,7 @@ object SmokeSpec : Spek({
test("see if own assertion function without i18n can be used") {
assertThat(2).isEven()
+ assertThat(1).isOdd()
}
test("see if own assertion function with i18n can be used") {
@@ -34,7 +36,10 @@ object SmokeSpec : Spek({
})
fun Expect.isEven() =
- createAndAddAssertion(DescriptionBasic.IS, Text("an even number")) { it % 2 == 0 }
+ _logic.createAndAppendAssertion("is", Text("an even number")) { it % 2 == 0 }
+
+fun Expect.isOdd() =
+ _logic.appendAssertion(_logic.createDescriptiveAssertion(DescriptionBasic.IS, Text("an odd number")) { it % 2 == 1 })
fun Expect.isMultipleOf(base: Int) = _logicAppend { isMultipleOf(base) }
diff --git a/bundles/fluent-en_GB/extensions/atrium-fluent-en_GB-smoke-test-kotlin_1_3/src/test/kotlin/custom/SmokeSpec.kt b/bundles/fluent-en_GB/extensions/atrium-fluent-en_GB-smoke-test-kotlin_1_3/src/test/kotlin/custom/SmokeSpec.kt
index 1f69efc91..2b61e733f 100644
--- a/bundles/fluent-en_GB/extensions/atrium-fluent-en_GB-smoke-test-kotlin_1_3/src/test/kotlin/custom/SmokeSpec.kt
+++ b/bundles/fluent-en_GB/extensions/atrium-fluent-en_GB-smoke-test-kotlin_1_3/src/test/kotlin/custom/SmokeSpec.kt
@@ -11,6 +11,7 @@ import ch.tutteli.atrium.api.verbs.expect
import ch.tutteli.atrium.assertions.Assertion
import ch.tutteli.atrium.creating.AssertionContainer
import ch.tutteli.atrium.creating.Expect
+import ch.tutteli.atrium.logic._logic
import ch.tutteli.atrium.logic._logicAppend
import ch.tutteli.atrium.logic.createDescriptiveAssertion
import ch.tutteli.atrium.reporting.Text
@@ -29,6 +30,7 @@ object SmokeSpec : Spek({
test("see if own assertion function without i18n can be used") {
expect(2).isEven()
+ expect(1).isOdd()
}
test("see if own assertion function with i18n can be used") {
@@ -36,8 +38,11 @@ object SmokeSpec : Spek({
}
})
-fun Expect.isEven(): Expect =
- createAndAddAssertion(DescriptionBasic.IS, Text("an even number")) { it % 2 == 0 }
+fun Expect.isEven() =
+ _logic.createAndAppendAssertion("is", Text("an even number")) { it % 2 == 0 }
+
+fun Expect.isOdd() =
+ _logic.appendAssertion(_logic.createDescriptiveAssertion(DescriptionBasic.IS, Text("an odd number")) { it % 2 == 1 })
fun Expect.isMultipleOf(base: Int): Expect = _logicAppend { isMultipleOf(base) }
diff --git a/bundles/infix-en_GB/atrium-infix-en_GB-common/src/test/kotlin/SmokeTest.kt b/bundles/infix-en_GB/atrium-infix-en_GB-common/src/test/kotlin/SmokeTest.kt
index 772f6aedc..5adadc943 100644
--- a/bundles/infix-en_GB/atrium-infix-en_GB-common/src/test/kotlin/SmokeTest.kt
+++ b/bundles/infix-en_GB/atrium-infix-en_GB-common/src/test/kotlin/SmokeTest.kt
@@ -3,6 +3,7 @@ import ch.tutteli.atrium.api.verbs.assertThat
import ch.tutteli.atrium.assertions.Assertion
import ch.tutteli.atrium.creating.AssertionContainer
import ch.tutteli.atrium.creating.Expect
+import ch.tutteli.atrium.logic._logic
import ch.tutteli.atrium.logic._logicAppend
import ch.tutteli.atrium.logic.createDescriptiveAssertion
import ch.tutteli.atrium.reporting.Text
@@ -20,6 +21,7 @@ class SmokeTest {
@Test
fun assertionFunctionWithoutI18nCanBeUsed() {
assertThat(2) tobe even
+ assertThat(1) tobe odd
}
@Test
@@ -53,10 +55,14 @@ class SmokeTest {
@Suppress("ClassName")
object even
+@Suppress("ClassName")
+object odd
-//TODO 0.17.0 also add test case for using the string overload once we have createAndAppend
infix fun Expect.tobe(@Suppress("UNUSED_PARAMETER") even: even) =
- createAndAddAssertion(IS, Text("an even number")) { it % 2 == 0 }
+ _logic.appendAssertion(_logic.createDescriptiveAssertion(IS, Text("an even number")) { it % 2 == 0 })
+
+infix fun Expect.tobe(@Suppress("UNUSED_PARAMETER") odd: odd) =
+ _logic.appendAssertion(_logic.createDescriptiveAssertion(IS, Text("an odd number")) { it % 2 == 1})
infix fun Expect.isMultipleOf(base: Int): Expect = _logicAppend { isMultipleOf(base) }
diff --git a/bundles/infix-en_GB/atrium-infix-en_GB-jvm/src/test/kotlin/custom/SmokeSpec.kt b/bundles/infix-en_GB/atrium-infix-en_GB-jvm/src/test/kotlin/custom/SmokeSpec.kt
index f368a89c8..9beb777a2 100644
--- a/bundles/infix-en_GB/atrium-infix-en_GB-jvm/src/test/kotlin/custom/SmokeSpec.kt
+++ b/bundles/infix-en_GB/atrium-infix-en_GB-jvm/src/test/kotlin/custom/SmokeSpec.kt
@@ -5,6 +5,7 @@ import ch.tutteli.atrium.api.verbs.assertThat
import ch.tutteli.atrium.assertions.Assertion
import ch.tutteli.atrium.creating.AssertionContainer
import ch.tutteli.atrium.creating.Expect
+import ch.tutteli.atrium.logic._logic
import ch.tutteli.atrium.logic._logicAppend
import ch.tutteli.atrium.logic.createDescriptiveAssertion
import ch.tutteli.atrium.reporting.Text
@@ -19,6 +20,7 @@ object SmokeSpec : Spek({
test("see if own assertion function without i18n can be used") {
assertThat(2) tobe even
+ assertThat(1) tobe odd
}
test("see if own assertion function with i18n can be used") {
@@ -28,9 +30,14 @@ object SmokeSpec : Spek({
@Suppress("ClassName")
object even
+@Suppress("ClassName")
+object odd
infix fun Expect.tobe(@Suppress("UNUSED_PARAMETER") even: even) =
- createAndAddAssertion(DescriptionBasic.IS, Text("an even number")) { it % 2 == 0 }
+ _logic.appendAssertion(_logic.createDescriptiveAssertion(DescriptionBasic.IS, Text("an even number")) { it % 2 == 0 })
+
+infix fun Expect.tobe(@Suppress("UNUSED_PARAMETER") odd: odd) =
+ _logic.appendAssertion(_logic.createDescriptiveAssertion(DescriptionBasic.IS, Text("an odd number")) { it % 2 == 1 })
infix fun Expect.isMultipleOf(base: Int): Expect = _logicAppend { isMultipleOf(base) }
diff --git a/bundles/infix-en_GB/extensions/atrium-infix-en_GB-smoke-test-kotlin_1_3/src/test/kotlin/custom/SmokeSpec.kt b/bundles/infix-en_GB/extensions/atrium-infix-en_GB-smoke-test-kotlin_1_3/src/test/kotlin/custom/SmokeSpec.kt
index 943db7ae7..b56860b67 100644
--- a/bundles/infix-en_GB/extensions/atrium-infix-en_GB-smoke-test-kotlin_1_3/src/test/kotlin/custom/SmokeSpec.kt
+++ b/bundles/infix-en_GB/extensions/atrium-infix-en_GB-smoke-test-kotlin_1_3/src/test/kotlin/custom/SmokeSpec.kt
@@ -12,6 +12,7 @@ import ch.tutteli.atrium.api.verbs.expect
import ch.tutteli.atrium.assertions.Assertion
import ch.tutteli.atrium.creating.AssertionContainer
import ch.tutteli.atrium.creating.Expect
+import ch.tutteli.atrium.logic._logic
import ch.tutteli.atrium.logic._logicAppend
import ch.tutteli.atrium.logic.createDescriptiveAssertion
import ch.tutteli.atrium.reporting.Text
@@ -30,6 +31,7 @@ object SmokeSpec : Spek({
test("see if own assertion function without i18n can be used") {
expect(2) tobe even
+ expect(1) tobe odd
}
test("see if own assertion function with i18n can be used") {
@@ -39,9 +41,14 @@ object SmokeSpec : Spek({
@Suppress("ClassName")
object even
+@Suppress("ClassName")
+object odd
infix fun Expect.tobe(@Suppress("UNUSED_PARAMETER") even: even) =
- createAndAddAssertion(DescriptionBasic.IS, Text("an even number")) { it % 2 == 0 }
+ _logic.appendAssertion(_logic.createDescriptiveAssertion(DescriptionBasic.IS, Text("an even number")) { it % 2 == 0 })
+
+infix fun Expect.tobe(@Suppress("UNUSED_PARAMETER") odd: odd) =
+ _logic.appendAssertion(_logic.createDescriptiveAssertion(DescriptionBasic.IS, Text("an odd number")) { it % 2 == 1 })
infix fun Expect.isMultipleOf(base: Int): Expect = _logicAppend { isMultipleOf(base) }
diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/AssertionBuilder.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/AssertionBuilder.kt
index 2e378e6c5..8d3e99dd4 100644
--- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/AssertionBuilder.kt
+++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/AssertionBuilder.kt
@@ -163,22 +163,22 @@ interface AssertionBuilder {
* @param representation The representation of the expected outcome.
* @param test The test which checks whether the assertion holds.
*/
- //TODO remove with 0.17.0
+ //TODO remove with 0.18.0
@Suppress("DEPRECATION")
@Deprecated(
- "Use _logic.createDescriptive instead; will be removed with 0.17.0",
+ "Use _logic.createDescriptive instead; will be removed with 0.18.0",
ReplaceWith(
- "container.createDescriptiveAssertion",
+ "container.createDescriptiveAssertion(expect, description, represetnation, test)",
"ch.tutteli.atrium.logic._logic",
"ch.tutteli.atrium.logic.createDescriptiveAssertion"
)
)
fun createDescriptive(
- subjectProvider: ch.tutteli.atrium.creating.SubjectProvider,
+ expect: Expect,
description: String,
representation: Any?,
test: (T) -> Boolean
- ): DescriptiveAssertion = createDescriptive(subjectProvider, Untranslatable(description), representation, test)
+ ): DescriptiveAssertion = createDescriptive(expect, Untranslatable(description), representation, test)
/**
* Creates a [DescriptiveAssertion] based on the [description], [representation] and [test] as well as the
@@ -201,23 +201,23 @@ interface AssertionBuilder {
* @param representation The representation of the expected outcome.
* @param test The test which checks whether the assertion holds.
*/
- //TODO remove with 0.17.0
+ //TODO remove with 0.18.0
@Deprecated(
- "Use extension AssertionContainer.createDescriptiveAssertion instead - e.g. _logic.createDescriptiveAssertion; will be removed with 0.17.0",
+ "Use extension AssertionContainer.createDescriptiveAssertion instead - e.g. _logic.createDescriptiveAssertion; will be removed with 0.18.0",
ReplaceWith(
- "container.createDescriptiveAssertion",
+ "container.createDescriptiveAssertion(expect, description, represetantion, test)",
"ch.tutteli.atrium.logic._logic",
"ch.tutteli.atrium.logic.createDescriptiveAssertion"
)
)
fun createDescriptive(
- @Suppress("DEPRECATION") subjectProvider: ch.tutteli.atrium.creating.SubjectProvider,
+ expect: Expect,
description: Translatable,
representation: Any?,
test: (T) -> Boolean
): DescriptiveAssertion =
descriptive
- .withTest(subjectProvider, test)
+ .withTest(expect, test)
.withDescriptionAndRepresentation(description, representation)
.build()
}
diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/SubjectBasedOption.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/SubjectBasedOption.kt
index b9bb6cce7..daa935d86 100644
--- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/SubjectBasedOption.kt
+++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/SubjectBasedOption.kt
@@ -1,5 +1,8 @@
package ch.tutteli.atrium.assertions.builders
+import ch.tutteli.atrium.creating.AssertionContainer
+import ch.tutteli.atrium.creating.Expect
+
/**
* Contract for sub option steps which are based on a defined or absent subject of the expectation.
*/
@@ -40,12 +43,13 @@ interface SubjectBasedOption {
companion object {
@Suppress("DEPRECATION")
operator fun > invoke(
- subjectProvider: ch.tutteli.atrium.creating.SubjectProvider,
+ expect: Expect,
subStep: PO.() -> Pair<() -> R, (T) -> R>,
presentOptionFactory: () -> PO
): R {
val (ifAbsent, ifPresent) = presentOptionFactory().subStep()
- return subjectProvider.maybeSubject.fold(ifAbsent, ifPresent)
+ @Suppress("UNCHECKED_CAST")
+ return (expect as AssertionContainer).maybeSubject.fold(ifAbsent, ifPresent)
}
}
}
diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/common/HoldsStep.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/common/HoldsStep.kt
index c6a806516..30a00354b 100644
--- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/common/HoldsStep.kt
+++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/common/HoldsStep.kt
@@ -2,6 +2,7 @@ package ch.tutteli.atrium.assertions.builders.common
import ch.tutteli.atrium.assertions.Assertion
import ch.tutteli.atrium.assertions.RepresentationOnlyAssertion
+import ch.tutteli.atrium.creating.Expect
/**
* Step which allows to specify [RepresentationOnlyAssertion.holds].
@@ -34,9 +35,9 @@ interface HoldsStep {
* @return `true` in case [SubjectProvider.maybeSubject] is None or the result of [test] passing the subject.
*/
//TODO if we introduce Record or something else as replacement for Assertion then not but if we keep Assertion
- // then move to logic and expect AssertionContainer with 0.16.0
+ // then move to logic and expect ProofContainer with 0.18.0
fun withTest(
- @Suppress("DEPRECATION") subjectProvider: ch.tutteli.atrium.creating.SubjectProvider,
+ expect: Expect,
test: (T) -> Boolean
): R
}
diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/common/impl/HoldsStepImpl.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/common/impl/HoldsStepImpl.kt
index c96ce53bd..1faaed775 100644
--- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/common/impl/HoldsStepImpl.kt
+++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/common/impl/HoldsStepImpl.kt
@@ -2,6 +2,8 @@ package ch.tutteli.atrium.assertions.builders.common.impl
import ch.tutteli.atrium.assertions.builders.common.HoldsStep
import ch.tutteli.atrium.core.falseProvider
+import ch.tutteli.atrium.creating.AssertionContainer
+import ch.tutteli.atrium.creating.Expect
internal abstract class HoldsStepImpl : HoldsStep {
//TODO use falseProvider https://youtrack.jetbrains.com/issue/KT-27736
@@ -9,8 +11,9 @@ internal abstract class HoldsStepImpl : HoldsStep {
//TODO use trueProvider https://youtrack.jetbrains.com/issue/KT-27736
override val holding: R = withTest { true }
- override fun withTest(@Suppress("DEPRECATION") subjectProvider: ch.tutteli.atrium.creating.SubjectProvider, test: (T) -> Boolean): R = withTest {
- subjectProvider.maybeSubject.fold(falseProvider, test)
+ override fun withTest(expect: Expect, test: (T) -> Boolean): R = withTest {
+ @Suppress("UNCHECKED_CAST")
+ (expect as AssertionContainer).maybeSubject.fold(falseProvider, test)
}
final override fun withTest(test: () -> Boolean): R = createNextStep(test)
diff --git a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/descriptive.kt b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/descriptive.kt
index 4973ccdf5..a35021163 100644
--- a/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/descriptive.kt
+++ b/core/api/atrium-core-api-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/descriptive.kt
@@ -5,6 +5,7 @@ import ch.tutteli.atrium.assertions.DescriptiveAssertion
import ch.tutteli.atrium.assertions.builders.impl.descriptive.DescriptionOptionImpl
import ch.tutteli.atrium.assertions.builders.impl.descriptive.FinalStepImpl
import ch.tutteli.atrium.assertions.builders.impl.descriptive.HoldsOptionImpl
+import ch.tutteli.atrium.creating.Expect
import ch.tutteli.atrium.reporting.Text
import ch.tutteli.atrium.reporting.translating.Translatable
import ch.tutteli.atrium.reporting.translating.Untranslatable
@@ -34,16 +35,15 @@ interface Descriptive {
fun withTest(test: () -> Boolean): DescriptionOption
/**
- * Uses the given [test] as [DescriptiveAssertion.holds] based on the subject provided by [subjectProvider].
+ * Uses the given [test] as [DescriptiveAssertion.holds] based on the subject provided by [expect].
*
* Notice, this function might change its signature with 1.0.0 to something like
* ```
* fun withTest(expect: Expect, test: (T) -> Boolean): DescriptionOption
* ```
*/
- //TODO 0.18.0: don't use SubjectProvider in the new ProofBuilder but ProofContainer instead
fun withTest(
- @Suppress("DEPRECATION") subjectProvider: ch.tutteli.atrium.creating.SubjectProvider,
+ expect: Expect