diff --git a/README.md b/README.md index 940b9deb9..6400e997e 100644 --- a/README.md +++ b/README.md @@ -2010,7 +2010,7 @@ This is kind of the simplest way of defining assertion functions. Following an e import ch.tutteli.atrium.logic._logic fun Expect.toBeAMultipleOf(base: Int) = - _logic.createAndAppendAssertion("is multiple of", base) { it % base == 0 } + _logic.createAndAppend("is multiple of", base) { it % base == 0 } ``` @@ -2060,7 +2060,7 @@ Consider the following assertion function: import ch.tutteli.atrium.logic._logic fun Expect.toBeEven() = - _logic.createAndAppendAssertion("is", Text("an even number")) { it % 2 == 0 } + _logic.createAndAppend("is", Text("an even number")) { it % 2 == 0 } ``` @@ -2109,7 +2109,7 @@ if you want that both are evaluated: import ch.tutteli.atrium.logic._logic fun Expect.toBeBetween(lowerBoundInclusive: T, upperBoundExclusive: T) = - _logic.appendAssertionsCreatedBy { + _logic.appendAsGroup { toBeGreaterThanOrEqualTo(lowerBoundInclusive) toBeLessThan(upperBoundExclusive) } @@ -2481,7 +2481,7 @@ we do no longer use a `String` but a proper `Translatable`. import ch.tutteli.atrium.logic.* fun Expect.toBeAMultipleOf(base: Int): Expect = _logic.run { - appendAssertion( + append( createDescriptiveAssertion(DescriptionIntAssertion.TO_BE_A_MULTIPLE_OF, base) { it % base == 0 } ) } @@ -2533,7 +2533,7 @@ as second example: import ch.tutteli.atrium.logic.* fun Expect.toBeEven(): Expect = _logic.run { - appendAssertion( + append( createDescriptiveAssertion(DescriptionBasic.IS, DescriptionIntAssertions.EVEN) { it % 2 == 0 } ) } 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 d3080dcb6..ed2296bc6 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 @@ -216,7 +216,7 @@ inline val Expect.and: Expect get() = this * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.AnyExpectationSamples.and */ infix fun Expect.and(assertionCreator: Expect.() -> Unit): Expect = - _logic.appendAssertionsCreatedBy(assertionCreator) + _logic.appendAsGroup(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 2bb5db9eb..2c0e64c96 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 @@ -35,7 +35,7 @@ fun Expect>.asList(): Expect> = * @since 0.9.0 */ fun Expect>.asList(assertionCreator: Expect>.() -> Unit): Expect> = - apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList()._logic.appendAsGroup(assertionCreator) } /** * Expects that the subject of `this` expectation holds all assertions the given [assertionCreator] creates for @@ -52,7 +52,7 @@ fun Expect>.asList(assertionCreator: Expect>.() -> Unit): E */ @JvmName("asListEOut") fun Expect>.asList(assertionCreator: Expect>.() -> Unit): Expect> = - apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList()._logic.appendAsGroup(assertionCreator) } /** * Turns `Expect` into `Expect>`. @@ -85,7 +85,7 @@ fun Expect.asList(): Expect> = */ @JvmName("byteArrAsList") fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList()._logic.appendAsGroup(assertionCreator) } /** @@ -119,7 +119,7 @@ fun Expect.asList(): Expect> = */ @JvmName("charArrAsList") fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList()._logic.appendAsGroup(assertionCreator) } /** @@ -153,7 +153,7 @@ fun Expect.asList(): Expect> = */ @JvmName("shortArrAsList") fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList()._logic.appendAsGroup(assertionCreator) } /** @@ -187,7 +187,7 @@ fun Expect.asList(): Expect> = */ @JvmName("intArrAsList") fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList()._logic.appendAsGroup(assertionCreator) } /** @@ -221,7 +221,7 @@ fun Expect.asList(): Expect> = */ @JvmName("longArrAsList") fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList()._logic.appendAsGroup(assertionCreator) } /** @@ -255,7 +255,7 @@ fun Expect.asList(): Expect> = */ @JvmName("floatArrAsList") fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList()._logic.appendAsGroup(assertionCreator) } /** @@ -289,7 +289,7 @@ fun Expect.asList(): Expect> = */ @JvmName("doubleArrAsList") fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList()._logic.appendAsGroup(assertionCreator) } /** @@ -323,4 +323,4 @@ fun Expect.asList(): Expect> = */ @JvmName("boolArrAsList") fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList()._logic.appendAsGroup(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 68b2c6f90..787ab0f80 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 @@ -404,4 +404,4 @@ fun > Expect.asList(): Expect> = _logic.changeSubj * @since 0.14.0 */ fun > Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList()._logic.appendAsGroup(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 419fa1631..fe8a75240 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 @@ -277,7 +277,7 @@ fun > Expect.asEntries(): Expect> */ fun > Expect.asEntries( assertionCreator: Expect>>.() -> Unit -): Expect = apply { asEntries()._logic.appendAssertionsCreatedBy(assertionCreator) } +): Expect = apply { asEntries()._logic.appendAsGroup(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 6fb67ffc6..47af77359 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 @@ -26,7 +26,7 @@ fun > Expect.asIterable(): Expect> = * @return an [Expect] for the subject of `this` expectation. */ fun > Expect.asIterable(assertionCreator: Expect>.() -> Unit): Expect = - apply { asIterable()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asIterable()._logic.appendAsGroup(assertionCreator) } /** * Turns `Expect>` into `Expect`. @@ -52,4 +52,4 @@ fun > Expect.asList(): Expect> = _logic.changeSubj * @since 0.14.0 */ fun > Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList()._logic.appendAsGroup(assertionCreator) } 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 ec6f9d793..2fc871ddd 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 @@ -37,4 +37,4 @@ fun Expect.asPath(): Expect = * @since 0.9.0 */ fun Expect.asPath(assertionCreator: Expect.() -> Unit): Expect = - apply { asPath()._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asPath()._logic.appendAsGroup(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 68a7217a3..716237d8e 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 @@ -246,7 +246,7 @@ inline infix fun Expect.and(@Suppress("UNUSED_PARAMETER") o: o): Expect Expect.and(assertionCreator: Expect.() -> Unit): Expect = - _logic.appendAssertionsCreatedBy(assertionCreator) + _logic.appendAsGroup(assertionCreator) //TODO 0.17.0 deprecate? /** 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 b7e9e18cd..819fd4070 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 @@ -35,7 +35,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)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList(o)._logic.appendAsGroup(assertionCreator) } /** * Expects that the subject of `this` expectation holds all assertions the given [assertionCreator] creates for @@ -52,7 +52,7 @@ infix fun Expect>.asList(assertionCreator: Expect>.() -> Un */ @JvmName("asListEOut") infix fun Expect>.asList(assertionCreator: Expect>.() -> Unit): Expect> = - apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList(o)._logic.appendAsGroup(assertionCreator) } /** * Turns `Expect` into `Expect>`. @@ -85,7 +85,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList(o)._logic.appendAsGroup(assertionCreator) } /** @@ -119,7 +119,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList(o)._logic.appendAsGroup(assertionCreator) } /** @@ -153,7 +153,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect< */ @JvmName("shortArrAsList") infix fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList(o)._logic.appendAsGroup(assertionCreator) } /** @@ -187,7 +187,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect
  • .asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList(o)._logic.appendAsGroup(assertionCreator) } /** @@ -221,7 +221,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList(o)._logic.appendAsGroup(assertionCreator) } /** @@ -255,7 +255,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect< */ @JvmName("floatArrAsList") infix fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList(o)._logic.appendAsGroup(assertionCreator) } /** @@ -289,7 +289,7 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expect */ @JvmName("doubleArrAsList") infix fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList(o)._logic.appendAsGroup(assertionCreator) } /** @@ -323,4 +323,4 @@ infix fun Expect.asList(@Suppress("UNUSED_PARAMETER") o: o): Expec */ @JvmName("boolArrAsList") infix fun Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList(o)._logic.appendAsGroup(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 9e08f46e7..9fd92679d 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 @@ -454,4 +454,4 @@ infix fun > Expect.asList( * @since 0.14.0 */ infix fun > Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList(o)._logic.appendAsGroup(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 a099cc9a7..79a1b9a07 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 @@ -351,7 +351,7 @@ infix fun > Expect.asEntries( */ infix fun > Expect.asEntries( assertionCreator: Expect>>.() -> Unit -): Expect = apply { asEntries(o)._logic.appendAssertionsCreatedBy(assertionCreator) } +): Expect = apply { asEntries(o)._logic.appendAsGroup(assertionCreator) } //TODO move to mapExpectations.kt with 0.18.0 /** 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 b64c34459..d61c6206f 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 @@ -27,7 +27,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)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asIterable(o)._logic.appendAsGroup(assertionCreator) } /** * Turns `Expect>` into `Expect`. @@ -55,4 +55,4 @@ infix fun > Expect.asList( * @since 0.14.0 */ infix fun > Expect.asList(assertionCreator: Expect>.() -> Unit): Expect = - apply { asList(o)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asList(o)._logic.appendAsGroup(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 a4085c592..aa7640aad 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 @@ -37,4 +37,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)._logic.appendAssertionsCreatedBy(assertionCreator) } + apply { asPath(o)._logic.appendAsGroup(assertionCreator) } 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 549cca945..b467c5816 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 @@ -108,10 +108,10 @@ class SmokeTest { } fun Expect.toBeEven() = - _logic.createAndAppendAssertion("is", Text("an even number")) { it % 2 == 0 } + _logic.createAndAppend("is", Text("an even number")) { it % 2 == 0 } fun Expect.toBeOdd() = - _logic.appendAssertion(_logic.createDescriptiveAssertion(IS, Text("an odd number")) { it % 2 == 1 }) + _logic.append(_logic.createDescriptiveAssertion(IS, Text("an odd number")) { it % 2 == 1 }) fun Expect.toBeAMultipleOf(base: Int): Expect = _logicAppend { toBeAMultipleOf(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 519d786a1..9d823f9aa 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 @@ -35,10 +35,10 @@ object SmokeSpec : Spek({ }) fun Expect.toBeEven() = - _logic.createAndAppendAssertion("is", Text("an even number")) { it % 2 == 0 } + _logic.createAndAppend("is", Text("an even number")) { it % 2 == 0 } fun Expect.toBeOdd() = - _logic.appendAssertion(_logic.createDescriptiveAssertion(DescriptionBasic.IS, Text("an odd number")) { it % 2 == 1 }) + _logic.append(_logic.createDescriptiveAssertion(DescriptionBasic.IS, Text("an odd number")) { it % 2 == 1 }) fun Expect.toBeAMultipleOf(base: Int) = _logicAppend { toBeAMultipleOf(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 bac2b3b2e..c60e5adca 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 @@ -39,10 +39,10 @@ object SmokeSpec : Spek({ }) fun Expect.isEven() = - _logic.createAndAppendAssertion("is", Text("an even number")) { it % 2 == 0 } + _logic.createAndAppend("is", Text("an even number")) { it % 2 == 0 } fun Expect.isOdd() = - _logic.appendAssertion(_logic.createDescriptiveAssertion(DescriptionBasic.IS, Text("an odd number")) { it % 2 == 1 }) + _logic.append(_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 23e60304c..ea695f678 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 @@ -59,10 +59,10 @@ object even object odd infix fun Expect.toBe(@Suppress("UNUSED_PARAMETER") even: even) = - _logic.appendAssertion(_logic.createDescriptiveAssertion(IS, Text("an even number")) { it % 2 == 0 }) + _logic.append(_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}) + _logic.append(_logic.createDescriptiveAssertion(IS, Text("an odd number")) { it % 2 == 1}) infix fun Expect.toBeAMultipleOf(base: Int): Expect = _logicAppend { toBeAMultipleOf(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 2c534beec..4530a05ef 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 @@ -34,10 +34,10 @@ object even object odd infix fun Expect.tobe(@Suppress("UNUSED_PARAMETER") even: even) = - _logic.appendAssertion(_logic.createDescriptiveAssertion(DescriptionBasic.IS, Text("an even number")) { it % 2 == 0 }) + _logic.append(_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 }) + _logic.append(_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 215d9f73b..9ba076f08 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 @@ -45,10 +45,10 @@ object even object odd infix fun Expect.toBe(@Suppress("UNUSED_PARAMETER") even: even) = - _logic.appendAssertion(_logic.createDescriptiveAssertion(DescriptionBasic.IS, Text("an even number")) { it % 2 == 0 }) + _logic.append(_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 }) + _logic.append(_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/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/AssertionContainer.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/AssertionContainer.kt index 495859e3b..0ccac849e 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/AssertionContainer.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/AssertionContainer.kt @@ -33,6 +33,7 @@ interface AssertionContainer : @kotlin.Suppress("DEPRECATION") SubjectProvide * Might be we completely remove it without prior notice. */ //TODO 0.18.0/0.19.0 maybe it would be better to have proofFactories as val like we have components? + //TODO 0.18.0 I guess it would make sense to get rid of getImpl and only use the ComponentFactoryContainer approach @ExperimentalNewExpectTypes fun getImpl(kClass: KClass, defaultFactory: () -> I): I @@ -55,8 +56,7 @@ interface AssertionContainer : @kotlin.Suppress("DEPRECATION") SubjectProvide * * @throws AssertionError Might throw an [AssertionError] in case [Assertion]s are immediately evaluated. */ - //TODO 0.17.0 rename to append - this way we can use it also on ProofContainer and users won't notice anything as long as they recompile - fun appendAssertion(assertion: Assertion): Expect + fun append(assertion: Assertion): Expect /** * Appends the [Assertion]s the given [assertionCreator] creates to this container and @@ -72,12 +72,11 @@ interface AssertionContainer : @kotlin.Suppress("DEPRECATION") SubjectProvide * * @throws AssertionError Might throw an [AssertionError] in case [Assertion]s are immediately evaluated. */ - //TODO 0.17.0 rename to append - this way we can use it also on ProofContainer and users won't notice anything as long as they recompile - fun appendAssertionsCreatedBy(assertionCreator: Expect.() -> Unit): Expect + fun appendAsGroup(assertionCreator: Expect.() -> Unit): Expect /** * Creates a [DescriptiveAssertion] based on the given [description], [expected] and [test] - * and [appends][appendAssertion] it to the container. + * and [append]s it to the container. * * @param description The description of the assertion, e.g., `is less than`. * @param expected The expected value, e.g., `5` @@ -86,8 +85,7 @@ interface AssertionContainer : @kotlin.Suppress("DEPRECATION") SubjectProvide * @return an [Expect] for the subject of `this` expectation. */ //TODO remove SUPPRESS with 0.18.0 - //TODO 0.17.0 rename to append - this way we can use it also on ProofContainer and users won't notice anything as long as they recompile @Suppress("UNCHECKED_CAST", "DEPRECATION") - fun createAndAppendAssertion(description: String, expected: Any?, test: (T) -> Boolean): Expect = - appendAssertion(assertionBuilder.createDescriptive(this as Expect, Untranslatable(description),expected, test)) + fun createAndAppend(description: String, expected: Any?, test: (T) -> Boolean): Expect = + append(assertionBuilder.createDescriptive(this as Expect, Untranslatable(description),expected, test)) } diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/CollectingExpect.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/CollectingExpect.kt index 35134cd04..025958076 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/CollectingExpect.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/CollectingExpect.kt @@ -22,8 +22,8 @@ interface CollectingExpect : Expect { fun getAssertions(): List @Deprecated( - "use appendAssertionsCreatedBy; will be removed with 0.18.0", - ReplaceWith("this.appendAssertionsCreatedBy(assertionCreator)") + "use appendAsGroup; will be removed with 0.18.0", + ReplaceWith("this.appendAsGroup(assertionCreator)") ) override fun addAssertionsCreatedBy(assertionCreator: Expect.() -> Unit): CollectingExpect @@ -41,7 +41,7 @@ interface CollectingExpect : Expect { * * @throws AssertionError Might throw an [AssertionError] in case [Assertion]s are immediately evaluated. */ - fun appendAssertionsCreatedBy(assertionCreator: Expect.() -> Unit): CollectingExpect + fun appendAsGroup(assertionCreator: Expect.() -> Unit): CollectingExpect companion object { @Suppress( diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/Expect.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/Expect.kt index cab93201e..39b0b784d 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/Expect.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/Expect.kt @@ -63,8 +63,8 @@ interface Expect : @kotlin.Suppress("DEPRECATION") SubjectProvider { * @return an [Expect] for the subject of `this` expectation. */ @Deprecated( - "use _logic.appendAssertionsCreatedBy; will be removed with 0.18.0", - ReplaceWith("this._logic.appendAssertionsCreatedBy(assertionCreator)", "ch.tutteli.atrium.logic._logic") + "use _logic.appendAsGroup; will be removed with 0.18.0", + ReplaceWith("this._logic.appendAsGroup(assertionCreator)", "ch.tutteli.atrium.logic._logic") ) fun addAssertionsCreatedBy(assertionCreator: Expect.() -> Unit): Expect @@ -76,8 +76,8 @@ interface Expect : @kotlin.Suppress("DEPRECATION") SubjectProvider { * @return an [Expect] for the subject of `this` expectation. */ @Deprecated( - "use _logic.appendAssertion; will be removed with 0.18.0", - ReplaceWith("this._logic.appendAssertion(assertion)", "ch.tutteli.atrium.logic._logic") + "use _logic.append; will be removed with 0.18.0", + ReplaceWith("this._logic.append(assertion)", "ch.tutteli.atrium.logic._logic") ) override fun addAssertion(assertion: Assertion): Expect @@ -92,9 +92,9 @@ interface Expect : @kotlin.Suppress("DEPRECATION") SubjectProvider { * @return an [Expect] for the subject of `this` expectation. */ @Deprecated( - "use _logic.createAndAppendAssertion; will be removed with 0.18.0", + "use _logic.createAndAppend; will be removed with 0.18.0", ReplaceWith( - "this._logic.createAndAppendAssertion(description, expected, test)", + "this._logic.createAndAppend(description, expected, test)", "ch.tutteli.atrium.logic._logic" ) ) @@ -112,9 +112,9 @@ interface Expect : @kotlin.Suppress("DEPRECATION") SubjectProvider { * @return an [Expect] for the subject of `this` expectation. */ @Deprecated( - "use _logic.createAndAppendAssertion; will be removed with 0.18.0", + "use _logic.createAndAppend; will be removed with 0.18.0", ReplaceWith( - "this._logic.appendAssertion(this._logic.createDescriptiveAssertion(description, expected, test))", + "this._logic.append(this._logic.createDescriptiveAssertion(description, expected, test))", "ch.tutteli.atrium.logic._logic", "ch.tutteli.atrium.logic.createDescriptiveAssertion" ) diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/BaseExpectImpl.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/BaseExpectImpl.kt index be7232402..fcbec3555 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/BaseExpectImpl.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/BaseExpectImpl.kt @@ -43,21 +43,21 @@ abstract class BaseExpectImpl( //TODO remove with 0.18.0 override fun addAssertionsCreatedBy(assertionCreator: Expect.() -> Unit): Expect = - appendAssertionsCreatedBy(assertionCreator) + appendAsGroup(assertionCreator) - override fun appendAssertionsCreatedBy(assertionCreator: Expect.() -> Unit): Expect { + override fun appendAsGroup(assertionCreator: Expect.() -> Unit): Expect { val assertions = CollectingExpect(maybeSubject, components) - .appendAssertionsCreatedBy(assertionCreator) + .appendAsGroup(assertionCreator) .getAssertions() - return addAssertions(assertions) + return appendAsGroup(assertions) } - protected fun addAssertions(assertions: List): Expect { + protected fun appendAsGroup(assertions: List): Expect { return when (assertions.size) { 0 -> this - 1 -> appendAssertion(assertions.first()) - else -> appendAssertion(assertionBuilder.invisibleGroup.withAssertions(assertions).build()) + 1 -> append(assertions.first()) + else -> append(assertionBuilder.invisibleGroup.withAssertions(assertions).build()) } } diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/CollectingExpectImpl.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/CollectingExpectImpl.kt index e2f164503..fbe9a5533 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/CollectingExpectImpl.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/CollectingExpectImpl.kt @@ -16,15 +16,15 @@ internal class CollectingExpectImpl( override fun getAssertions(): List = assertions.toList() - override fun addAssertion(assertion: Assertion): Expect = appendAssertion(assertion) + override fun addAssertion(assertion: Assertion): Expect = append(assertion) - override fun appendAssertion(assertion: Assertion): Expect = + override fun append(assertion: Assertion): Expect = apply { assertions.add(assertion) } override fun addAssertionsCreatedBy(assertionCreator: Expect.() -> Unit): CollectingExpect = - appendAssertionsCreatedBy(assertionCreator) + appendAsGroup(assertionCreator) - override fun appendAssertionsCreatedBy(assertionCreator: Expect.() -> Unit): CollectingExpect { + override fun appendAsGroup(assertionCreator: Expect.() -> Unit): CollectingExpect { // in case we run into performance problems, the code below is certainly not ideal val allAssertions = mutableListOf() allAssertions.addAll(getAssertions()) @@ -56,7 +56,7 @@ internal class CollectingExpectImpl( .build() ) } - allAssertions.forEach { appendAssertion(it) } + allAssertions.forEach { append(it) } return this } diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/DelegatingExpectImpl.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/DelegatingExpectImpl.kt index 9affd2193..e680163aa 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/DelegatingExpectImpl.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/DelegatingExpectImpl.kt @@ -14,8 +14,8 @@ internal class DelegatingExpectImpl(private val container: AssertionContainer get() = container.components override fun addAssertion(assertion: Assertion): Expect = - appendAssertion(assertion) + append(assertion) - override fun appendAssertion(assertion: Assertion): Expect = + override fun append(assertion: Assertion): Expect = apply { container.addAssertion(assertion) } } diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/FeatureExpectImpl.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/FeatureExpectImpl.kt index 1936e5313..8f41beb1d 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/FeatureExpectImpl.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/FeatureExpectImpl.kt @@ -49,7 +49,7 @@ internal class FeatureExpectImpl( private val assertions: MutableList = mutableListOf() init { - addAssertions(assertions) + appendAsGroup(assertions) } override val components: ComponentFactoryContainer @@ -58,9 +58,9 @@ internal class FeatureExpectImpl( override fun addAssertion(assertion: Assertion): Expect = - appendAssertion(assertion) + append(assertion) - override fun appendAssertion(assertion: Assertion): Expect { + override fun append(assertion: Assertion): Expect { assertions.add(assertion) //Would be nice if we don't have to add it immediately to the previousExpect but only: //if (!assertion.holds()) { @@ -76,7 +76,7 @@ internal class FeatureExpectImpl( // //However, for this to work we would need to know when no more assertion is defined. This would be possible //for CollectingExpectImpl - (previousExpect as AssertionContainer<*>).appendAssertion( + (previousExpect as AssertionContainer<*>).append( assertionBuilder.feature .withDescriptionAndRepresentation(description, representation) .withAssertions(ArrayList(assertions)) diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/RootExpectImpl.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/RootExpectImpl.kt index 4fded7ec4..25b643cfb 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/RootExpectImpl.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/RootExpectImpl.kt @@ -55,9 +55,9 @@ internal class RootExpectImpl( private val assertions: MutableList = mutableListOf() override fun addAssertion(assertion: Assertion): Expect = - appendAssertion(assertion) + append(assertion) - override fun appendAssertion(assertion: Assertion): Expect { + override fun append(assertion: Assertion): Expect { assertions.add(assertion) if (!assertion.holds()) { val assertionGroup = assertionBuilder.root diff --git a/core/atrium-core-common/src/test/kotlin/ch/tutteli/atrium/assertions/builders/DescriptiveWithBasedOnSubjectSpec.kt b/core/atrium-core-common/src/test/kotlin/ch/tutteli/atrium/assertions/builders/DescriptiveWithBasedOnSubjectSpec.kt index 3212c7eb3..560425ede 100644 --- a/core/atrium-core-common/src/test/kotlin/ch/tutteli/atrium/assertions/builders/DescriptiveWithBasedOnSubjectSpec.kt +++ b/core/atrium-core-common/src/test/kotlin/ch/tutteli/atrium/assertions/builders/DescriptiveWithBasedOnSubjectSpec.kt @@ -11,7 +11,7 @@ import org.spekframework.spek2.Spek class DescriptiveWithBasedOnSubjectSpec : Spek({ fun addDescriptive(f: (Expect, Descriptive.HoldsOption) -> Assertion) = expectLambda { - _logic.appendAssertion(f(this, assertionBuilder.descriptive)) + _logic.append(f(this, assertionBuilder.descriptive)) } include(object : SubjectLessSpec("", diff --git a/core/atrium-core-common/src/test/kotlin/ch/tutteli/atrium/reporting/text/BulletPointProviderSpec.kt b/core/atrium-core-common/src/test/kotlin/ch/tutteli/atrium/reporting/text/BulletPointProviderSpec.kt index f6433830d..bb06a8241 100644 --- a/core/atrium-core-common/src/test/kotlin/ch/tutteli/atrium/reporting/text/BulletPointProviderSpec.kt +++ b/core/atrium-core-common/src/test/kotlin/ch/tutteli/atrium/reporting/text/BulletPointProviderSpec.kt @@ -33,8 +33,8 @@ class BulletPointProviderSpec : Spek({ expectWitNewBulletPoint(p, "a") toEqual "b" }), ListAssertionGroupType::class to ("- " to { p -> - expectWitNewBulletPoint(p, "a")._logic.appendAssertionsCreatedBy { - _logic.appendAssertion( + expectWitNewBulletPoint(p, "a")._logic.appendAsGroup { + _logic.append( assertionBuilder.list .withDescriptionAndEmptyRepresentation("hello") .withAssertion(_logic.toBe("b")).build() @@ -54,8 +54,8 @@ class BulletPointProviderSpec : Spek({ expectWitNewBulletPoint(p, listOf(1)) toContainExactly 2 }), ExplanatoryAssertionGroupType::class to (">> " to { p -> - expectWitNewBulletPoint(p, "a")._logic.appendAssertionsCreatedBy { - _logic.appendAssertion( + expectWitNewBulletPoint(p, "a")._logic.appendAsGroup { + _logic.append( assertionBuilder.explanatoryGroup .withDefaultType .withAssertion(_logic.toBe("b")) @@ -65,8 +65,8 @@ class BulletPointProviderSpec : Spek({ } }), WarningAssertionGroupType::class to ("(!) " to { p -> - expectWitNewBulletPoint(p, "a")._logic.appendAssertionsCreatedBy { - _logic.appendAssertion( + expectWitNewBulletPoint(p, "a")._logic.appendAsGroup { + _logic.append( assertionBuilder.explanatoryGroup .withWarningType .withAssertion(_logic.toBe("b")) @@ -76,8 +76,8 @@ class BulletPointProviderSpec : Spek({ } }), InformationAssertionGroupType::class to ("(i) " to { p -> - expectWitNewBulletPoint(p, "a")._logic.appendAssertionsCreatedBy { - _logic.appendAssertion( + expectWitNewBulletPoint(p, "a")._logic.appendAsGroup { + _logic.append( assertionBuilder.explanatoryGroup .withInformationType(false) .withAssertion(_logic.toBe("b")) diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/iterable/contains/creators/impl/InOrderOnlyBaseAssertionCreator.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/iterable/contains/creators/impl/InOrderOnlyBaseAssertionCreator.kt index 460509a14..2f3321f9f 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/iterable/contains/creators/impl/InOrderOnlyBaseAssertionCreator.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/iterable/contains/creators/impl/InOrderOnlyBaseAssertionCreator.kt @@ -46,7 +46,7 @@ abstract class InOrderOnlyBaseAssertionCreator( { emptyList() } ) if (list.size > index) { - _logic.appendAssertion( + _logic.append( createAdditionalElementsAssertion( container, index, @@ -81,7 +81,7 @@ abstract class InOrderOnlyBaseAssertionCreator( itr: Iterator ): Assertion { return container.collectBasedOnSubject(Some(iterableAsList)) { - _logic.appendAssertion(LazyThreadUnsafeAssertionGroup { + _logic.append(LazyThreadUnsafeAssertionGroup { val additionalEntries = itr.mapRemainingWithCounter { counter, it -> val description = TranslatableWithArgs( DescriptionIterableAssertion.ELEMENT_WITH_INDEX, diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/impl/BaseTransformationExecutionStep.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/impl/BaseTransformationExecutionStep.kt index 64d986e6f..53bcba4bf 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/impl/BaseTransformationExecutionStep.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/impl/BaseTransformationExecutionStep.kt @@ -6,7 +6,6 @@ import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.logic._logic import ch.tutteli.atrium.logic.collect import ch.tutteli.atrium.logic.creating.transformers.TransformationExecutionStep -import ch.tutteli.atrium.logic.toExpect /** * Step which has all necessary information to perform a subject transformation (subject change/feature extraction etc.) @@ -37,7 +36,7 @@ abstract class BaseTransformationExecutionStep>( * @return an [Expect] for the subject of this expectation. */ final override fun collectAndAppend(assertionCreator: Expect.() -> Unit): Expect = - container.appendAssertion(collect(assertionCreator)) + container.append(collect(assertionCreator)) /** * Finishes the transformation process by collecting the assertions the given [assertionCreator] creates diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/impl/DefaultSubjectChanger.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/impl/DefaultSubjectChanger.kt index 9d8cbbb52..59ffbd8ac 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/impl/DefaultSubjectChanger.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/impl/DefaultSubjectChanger.kt @@ -47,13 +47,13 @@ class DefaultSubjectChanger : SubjectChanger { .build() return if (shallTransform) { - val e = expect._logic.appendAssertion(descriptiveAssertion) + val e = expect._logic.append(descriptiveAssertion) maybeSubAssertions.fold({ e }) { assertionCreator -> - expect._logic.appendAssertionsCreatedBy(assertionCreator) + expect._logic.appendAsGroup(assertionCreator) } } else { val assertion = failureHandler.createAssertion(container, descriptiveAssertion, maybeSubAssertions) - expect._logic.appendAssertion(assertion) + expect._logic.append(assertion) } } } diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultAnyAssertions.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultAnyAssertions.kt index 362426cda..39521eafb 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultAnyAssertions.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultAnyAssertions.kt @@ -36,7 +36,7 @@ class DefaultAnyAssertions : AnyAssertions { } else { val collectSubject = container.maybeSubject.flatMap { if (it != null) Some(it) else None } val assertion = container.collectBasedOnSubject(collectSubject) { - _logic.appendAssertionsCreatedBy(assertionCreatorOrNull) + _logic.appendAsGroup(assertionCreatorOrNull) } //TODO 0.18.0 this is a pattern which occurs over and over again, maybe incorporate into collect? container.maybeSubject.fold( diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logic.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logic.kt index 31328a36c..6fa58a4d3 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logic.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logic.kt @@ -12,7 +12,7 @@ import ch.tutteli.atrium.creating.Expect * Use [_logic] for more sophisticated scenarios, like feature extraction. */ inline fun Expect._logicAppend(assertionCreator: AssertionContainer.() -> Assertion): Expect = - _logic.run { appendAssertion(assertionCreator()) } + _logic.run { append(assertionCreator()) } /** * Entry point to the logic level of Atrium -- which is one level deeper than the API -- diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logicCharSequenceContains.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logicCharSequenceContains.kt index 10b9bc741..de1fe529c 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logicCharSequenceContains.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logicCharSequenceContains.kt @@ -40,7 +40,7 @@ inline val inline fun CharSequenceContains.CheckerStep._logicAppend( factory: CharSequenceContains.CheckerStepLogic.() -> Assertion -): Expect = _logic.let { l -> l.entryPointStepLogic.container.appendAssertion(l.factory()) } +): 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 -- diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logicIterableLikeContains.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logicIterableLikeContains.kt index 2e52731fd..879b25679 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logicIterableLikeContains.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logicIterableLikeContains.kt @@ -18,7 +18,7 @@ import ch.tutteli.atrium.reporting.BUG_REPORT_URL inline fun IterableLikeContains.EntryPointStep._logicAppend( factory: IterableLikeContains.EntryPointStepLogic.() -> Assertion -): Expect = _logic.let { l -> l.container.appendAssertion(l.factory()) } +): 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 -- @@ -52,7 +52,7 @@ inline val inline fun IterableLikeContains.CheckerStep._logicAppend( factory: IterableLikeContains.CheckerStepLogic.() -> Assertion -): Expect = _logic.let { l -> l.entryPointStepLogic.container.appendAssertion(l.factory()) } +): 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 -- diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logicMapLikeContains.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logicMapLikeContains.kt index 101ecd14f..5bc5dd32e 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logicMapLikeContains.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logicMapLikeContains.kt @@ -15,7 +15,7 @@ import ch.tutteli.atrium.reporting.BUG_REPORT_URL inline fun MapLikeContains.EntryPointStep._logicAppend( factory: MapLikeContains.EntryPointStepLogic.() -> Assertion -): Expect = _logic.let { l -> l.container.appendAssertion(l.factory()) } +): 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 -- diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt index baa9d022d..bd5de0d15 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt @@ -50,7 +50,7 @@ abstract class SubjectLessSpec( .withDefaultType .withAssertions(assertions) .build() - expect._logic.appendAssertion(explanatoryGroup) + expect._logic.append(explanatoryGroup) } } } diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/CharSequenceToContainNotToContainExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/CharSequenceToContainNotToContainExpectationsSpec.kt index 0ff4d8c01..16e9740ac 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/CharSequenceToContainNotToContainExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/CharSequenceToContainNotToContainExpectationsSpec.kt @@ -170,7 +170,7 @@ abstract class CharSequenceToContainNotToContainExpectationsSpec( val nameWithArrow = "${featureArrow}name" it("${toContain.name} 'treboR' and 'llotS' - error message toContain '$nameWithArrow' exactly once") { expect { - expect(person)._logic.appendAssertionsCreatedBy { + expect(person)._logic.appendAsGroup { feature(Person::name).toContainFun("treboR", "llotS") } }.toThrow { @@ -179,7 +179,7 @@ abstract class CharSequenceToContainNotToContainExpectationsSpec( } it("${notToContain.name} 'Robert' and 'Stoll' - error message toContain '$nameWithArrow' exactly once") { expect { - expect(person)._logic.appendAssertionsCreatedBy { + expect(person)._logic.appendAsGroup { feature(Person::name).notToContainFun("Robert", "Stoll") } }.toThrow { diff --git a/misc/specs/atrium-specs-jvm/src/main/kotlin/ch/tutteli/atrium/specs/reporting/translating/TranslatorIntSpec.kt b/misc/specs/atrium-specs-jvm/src/main/kotlin/ch/tutteli/atrium/specs/reporting/translating/TranslatorIntSpec.kt index 22de4675d..d14b0c124 100644 --- a/misc/specs/atrium-specs-jvm/src/main/kotlin/ch/tutteli/atrium/specs/reporting/translating/TranslatorIntSpec.kt +++ b/misc/specs/atrium-specs-jvm/src/main/kotlin/ch/tutteli/atrium/specs/reporting/translating/TranslatorIntSpec.kt @@ -191,7 +191,7 @@ abstract class TranslatorIntSpec( it("uses the translation form 'fr' but the primary Locale to format the date") { expect { val assertwithdechFr = assertWithDeCh_Fr(1) - assertwithdechFr._logic.appendAssertion(assertwithdechFr._logic.createDescriptiveAssertion( + assertwithdechFr._logic.append(assertwithdechFr._logic.createDescriptiveAssertion( TranslatableWithArgs( TestTranslatable.DATE_KNOWN, firstOfFeb2017, @@ -206,7 +206,7 @@ abstract class TranslatorIntSpec( it("uses default translation but the primary Locale to format the date") { expect { val assertwithdechFr = assertWithDeCh_Fr(1) - assertwithdechFr._logic.appendAssertion(assertwithdechFr._logic.createDescriptiveAssertion( + assertwithdechFr._logic.append(assertwithdechFr._logic.createDescriptiveAssertion( TranslatableWithArgs( TestTranslatable.DATE_UNKNOWN, firstOfFeb2017 @@ -226,7 +226,7 @@ abstract class TranslatorIntSpec( ) { expect { val assertwithdechFr = assertWithDeCh_Fr(1) - assertwithdechFr._logic.appendAssertion(assertwithdechFr._logic.createDescriptiveAssertion( + assertwithdechFr._logic.append(assertwithdechFr._logic.createDescriptiveAssertion( TranslatableWithArgs( TestTranslatable.PLACEHOLDER, toBe @@ -251,7 +251,7 @@ abstract class TranslatorIntSpec( it("uses the translation form 'fr' but the primary Locale to format the date") { expect { val assertwithdechFrchItch = assertWithDeCh_FrCh_ItCh(1) - assertwithdechFrchItch._logic.appendAssertion(assertwithdechFrchItch._logic.createDescriptiveAssertion( + assertwithdechFrchItch._logic.append(assertwithdechFrchItch._logic.createDescriptiveAssertion( TranslatableWithArgs( TestTranslatable.DATE_KNOWN, firstOfFeb2017, @@ -266,7 +266,7 @@ abstract class TranslatorIntSpec( it("uses 'it' but the primary Locale to format the date") { expect { val assertwithdechFrchItch = assertWithDeCh_FrCh_ItCh(1) - assertwithdechFrchItch._logic.appendAssertion(assertwithdechFrchItch._logic.createDescriptiveAssertion( + assertwithdechFrchItch._logic.append(assertwithdechFrchItch._logic.createDescriptiveAssertion( TranslatableWithArgs( TestTranslatable.DATE_UNKNOWN, firstOfFeb2017 diff --git a/misc/tools/readme-examples/src/main/kotlin/readme/examples/Between2Spec.kt b/misc/tools/readme-examples/src/main/kotlin/readme/examples/Between2Spec.kt index a123efbcb..389dc9fb4 100644 --- a/misc/tools/readme-examples/src/main/kotlin/readme/examples/Between2Spec.kt +++ b/misc/tools/readme-examples/src/main/kotlin/readme/examples/Between2Spec.kt @@ -30,7 +30,7 @@ object Between2Spec : Spek({ //snippet-own-compose-import-insert fun Expect.toBeBetween(lowerBoundInclusive: T, upperBoundExclusive: T) = - _logic.appendAssertionsCreatedBy { + _logic.appendAsGroup { toBeGreaterThanOrEqualTo(lowerBoundInclusive) toBeLessThan(upperBoundExclusive) } diff --git a/misc/tools/readme-examples/src/main/kotlin/readme/examples/I18nSpec.kt b/misc/tools/readme-examples/src/main/kotlin/readme/examples/I18nSpec.kt index 6e8d24cdb..5f1701601 100644 --- a/misc/tools/readme-examples/src/main/kotlin/readme/examples/I18nSpec.kt +++ b/misc/tools/readme-examples/src/main/kotlin/readme/examples/I18nSpec.kt @@ -38,7 +38,7 @@ object I18nSpec : Spek({ //snippet-import-logic-insert fun Expect.toBeAMultipleOf(base: Int): Expect = _logic.run { - appendAssertion( + append( createDescriptiveAssertion(DescriptionIntAssertion.TO_BE_A_MULTIPLE_OF, base) { it % base == 0 } ) } @@ -50,7 +50,7 @@ object I18nSpec : Spek({ //snippet-import-logic-insert fun Expect.toBeEven(): Expect = _logic.run { - appendAssertion( + append( createDescriptiveAssertion(DescriptionBasic.IS, DescriptionIntAssertions.EVEN) { it % 2 == 0 } ) } diff --git a/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt b/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt index 5b21c15b7..687a2dbed 100644 --- a/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt +++ b/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt @@ -34,7 +34,7 @@ object OwnExpectationFunctionsSpec : Spek({ //snippet-own-boolean-1-start fun Expect.toBeAMultipleOf(base: Int) = - _logic.createAndAppendAssertion("is multiple of", base) { it % base == 0 } + _logic.createAndAppend("is multiple of", base) { it % base == 0 } //snippet-own-boolean-1-end test("code-own-boolean-1") { //snippet-own-boolean-import-insert @@ -47,7 +47,7 @@ object OwnExpectationFunctionsSpec : Spek({ //snippet-own-boolean-2-start fun Expect.toBeEven() = - _logic.createAndAppendAssertion("is", Text("an even number")) { it % 2 == 0 } + _logic.createAndAppend("is", Text("an even number")) { it % 2 == 0 } //snippet-own-boolean-2-end test("code-own-boolean-2") { //snippet-own-boolean-import-insert diff --git a/misc/tools/readme-examples/src/main/kotlin/readme/examples/utils/expect.kt b/misc/tools/readme-examples/src/main/kotlin/readme/examples/utils/expect.kt index 5d67859ae..38b116be7 100644 --- a/misc/tools/readme-examples/src/main/kotlin/readme/examples/utils/expect.kt +++ b/misc/tools/readme-examples/src/main/kotlin/readme/examples/utils/expect.kt @@ -17,7 +17,7 @@ fun expect(t: T): Expect = } fun expect(t: T, assertionCreator: Expect.() -> Unit): Expect = - expect(t)._logic.appendAssertionsCreatedBy(assertionCreator) + expect(t)._logic.appendAsGroup(assertionCreator) class ReadmeObjectFormatter(translator: Translator) : AbstractTextObjectFormatter(translator) { diff --git a/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt b/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt index c4ba2d861..061f697c1 100644 --- a/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt +++ b/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt @@ -41,7 +41,7 @@ fun expect(subject: T): RootExpect = * @throws AssertionError in case an assertion does not hold. */ fun expect(subject: T, assertionCreator: Expect.() -> Unit): Expect = - expect(subject)._logic.appendAssertionsCreatedBy(assertionCreator) + expect(subject)._logic.appendAsGroup(assertionCreator) /** * Defines the translation used for the assertion verbs used for internal purposes. diff --git a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assert.kt b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assert.kt index fd8779714..5f2acaa64 100644 --- a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assert.kt +++ b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assert.kt @@ -44,7 +44,7 @@ fun assert(subject: T): RootExpect = ReplaceWith("expect(subject, assertionCreator)", "ch.tutteli.atrium.api.verbs.expect") ) fun assert(subject: T, assertionCreator: Expect.() -> Unit): Expect = - assert(subject)._logic.appendAssertionsCreatedBy(assertionCreator) + assert(subject)._logic.appendAsGroup(assertionCreator) @Deprecated( "`assert` should not be nested, use `feature` instead.", diff --git a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assertThat.kt b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assertThat.kt index 0d62a9c7a..3ebd1f5ce 100644 --- a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assertThat.kt +++ b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/assertThat.kt @@ -44,7 +44,7 @@ fun assertThat(subject: T): RootExpect = ReplaceWith("expect(subject, assertionCreator)", "ch.tutteli.atrium.api.verbs.expect") ) fun assertThat(subject: T, assertionCreator: Expect.() -> Unit): Expect = - assertThat(subject)._logic.appendAssertionsCreatedBy(assertionCreator) + assertThat(subject)._logic.appendAsGroup(assertionCreator) @Deprecated( "`assertThat` should not be nested, use `feature` instead.", diff --git a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/expect.kt b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/expect.kt index d99f6714f..bea61442b 100644 --- a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/expect.kt +++ b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/expect.kt @@ -33,7 +33,7 @@ fun expect(subject: T): RootExpect = * @throws AssertionError in case an assertion does not hold. */ fun expect(subject: T, assertionCreator: Expect.() -> Unit): Expect = - expect(subject)._logic.appendAssertionsCreatedBy(assertionCreator) + expect(subject)._logic.appendAsGroup(assertionCreator) @Deprecated( "`expect` should not be nested, use `feature` instead.",