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 56e578bbd..3df2fbb23 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 @@ -141,6 +141,7 @@ fun > Expect.containsKey(key: K): Expect = fun > Expect.containsNotKey(key: K): Expect = _logicAppend { containsNotKey(::identity, key) } +//TODO move to mapExpectations.kt with 0.18.0 /** * Expects that the subject of `this` expectation (a [Map]) contains the given [key], * creates an [Expect] for the corresponding value and returns the newly created assertion container, @@ -153,6 +154,7 @@ fun > Expect.containsNotKey(key: K): Expect = fun > Expect.getExisting(key: K): Expect = _logic.getExisting(::identity, key).transform() +//TODO move to mapExpectations.kt with 0.18.0 /** * Expects that the subject of `this` expectation (a [Map]) contains the given [key] and that * the corresponding value holds all assertions the given [assertionCreator] creates for it. @@ -164,6 +166,7 @@ fun > Expect.getExisting(key: K): Expect = fun > Expect.getExisting(key: K, assertionCreator: Expect.() -> Unit): Expect = _logic.getExisting(::identity, key).collectAndAppend(assertionCreator) +//TODO move to mapExpectations.kt with 0.18.0 /** * Creates an [Expect] for the property [Map.keys] of the subject of `this` expectation, * so that further fluent calls are assertions about it. @@ -175,6 +178,7 @@ fun > Expect.getExisting(key: K, assertionCreator: Ex val > Expect.keys: Expect> get() = _logic.property(Map::keys).transform() +//TODO move to mapExpectations.kt with 0.18.0 /** * Expects that the property [Map.keys] of the subject of `this` expectation * holds all assertions the given [assertionCreator] creates for it and @@ -187,6 +191,7 @@ val > Expect.keys: Expect> fun > Expect.keys(assertionCreator: Expect>.() -> Unit): Expect = _logic.property(Map::keys).collectAndAppend(assertionCreator) +//TODO move to mapExpectations.kt with 0.18.0 /** * Creates an [Expect] for the property [Map.values] of the subject of `this` expectation, * so that further fluent calls are assertions about it. @@ -198,6 +203,7 @@ fun > Expect.keys(assertionCreator: Expect>.() val > Expect.values: Expect> get() = _logic.property(Map::values).transform() +//TODO move to mapExpectations.kt with 0.18.0 /** * Expects that the property [Map.keys] of the subject of `this` expectation * holds all assertions the given [assertionCreator] creates for it and @@ -210,6 +216,7 @@ val > Expect.values: Expect> fun > Expect.values(assertionCreator: Expect>.() -> Unit): Expect = _logic.property(Map::values).collectAndAppend(assertionCreator) +//TODO move to mapExpectations.kt with 0.18.0 /** * Turns `Expect>` into `Expect>>`. * @@ -223,6 +230,7 @@ fun > Expect.values(assertionCreator: Expect> Expect.asEntries(): Expect>> = _logic.changeSubject.unreported { it.entries } +//TODO move to mapExpectations.kt with 0.18.0 /** * Turns `Expect>` into `Expect>>` and expects that it holds all assertions the given * [assertionCreator] creates for it. diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/mapExpectations.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/mapExpectations.kt new file mode 100644 index 000000000..79dc63ef0 --- /dev/null +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/mapExpectations.kt @@ -0,0 +1,186 @@ +package ch.tutteli.atrium.api.fluent.en_GB + +import ch.tutteli.atrium.creating.Expect +import ch.tutteli.atrium.logic.* +import ch.tutteli.atrium.logic.creating.maplike.contains.searchbehaviours.NoOpSearchBehaviour +import ch.tutteli.atrium.logic.creating.maplike.contains.MapLikeContains +import ch.tutteli.atrium.logic.creating.typeutils.MapLike +import ch.tutteli.kbox.identity + +/** + * Starts a sophisticated `toContain` expectation building process based on this [Expect]. + * + * @return The newly created builder. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.MapExpectationSamples.toContainBuilder + * + * @since 0.17.0 + */ +val > Expect.toContain: MapLikeContains.EntryPointStep + get() = _logic.builderContainsInMapLike(::identity) + + +/** + * Expects that the subject of `this` expectation (a [Map]) contains a key as defined by [keyValuePair]'s [Pair.first] + * with a corresponding value as defined by [keyValuePair]'s [Pair.second] -- optionally the same assertions + * are created for the [otherPairs]. + * + * Delegates to `toContain.inAnyOrder.entries(keyValuePair, *otherPairs)` + * + * Notice, that it does not search for unique matches. Meaning, if the map is `mapOf('a' to 1)` and [keyValuePair] is + * defined as `'a' to 1` and one of the [otherPairs] is defined as `'a' to 1` as well, then both match, + * even though they match the same entry. + * + * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.MapExpectationSamples.toContainPair + * + * @since 0.17.0 + */ +fun > Expect.toContain( + keyValuePair: Pair, + vararg otherPairs: Pair +): Expect = toContain.inAnyOrder.entries(keyValuePair, *otherPairs) + +/** + * Expects that the subject of `this` expectation (a [Map]) contains only (in any order) a key as defined by + * [keyValuePair]'s [Pair.first] with a corresponding value as defined by [keyValuePair]'s [Pair.second] -- optionally + * the same assertions are created for the [otherPairs]. + * + * Delegates to `toContain.inAnyOrder.only.entries(keyValuePair, *otherPairs)` + * + * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.MapExpectationSamples.toContainOnlyPair + * + * @since 0.17.0 + */ +fun > Expect.toContainOnly( + keyValuePair: Pair, + vararg otherPairs: Pair +): Expect = toContain.inAnyOrder.only.entries(keyValuePair, *otherPairs) + +/** + * Expects that the subject of `this` expectation (a [Map]) contains a key as defined by [keyValue]'s [KeyValue.key] + * with a corresponding value which either holds all assertions [keyValue]'s + * [KeyValue.valueAssertionCreatorOrNull] creates or needs to be `null` in case + * [KeyValue.valueAssertionCreatorOrNull] is defined as `null` + * -- optionally the same assertions are created for the [otherKeyValues]. + * + * Delegates to `toContain.inAnyOrder.entries(keyValue, *otherKeyValues)` + * + * Notice, that it does not search for unique matches. Meaning, if the map is `mapOf('a' to 1)` and [keyValue] is + * defined as `Key('a') { isGreaterThan(0) }` and one of the [otherKeyValues] is defined as `Key('a') { isLessThan(2) }` + * , then both match, even though they match the same entry. + * + * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.MapExpectationSamples.toContainKeyValue + * + * @since 0.17.0 + */ +inline fun > Expect.toContain( + keyValue: KeyValue, + vararg otherKeyValues: KeyValue +): Expect = toContain.inAnyOrder.entries(keyValue, *otherKeyValues) + +/** + * Expects that the subject of `this` expectation (a [Map]) contains only (in any order) a key as defined by + * [keyValue]'s [KeyValue.key] with a corresponding value which either holds all assertions [keyValue]'s + * [KeyValue.valueAssertionCreatorOrNull] creates or needs to be `null` in case + * [KeyValue.valueAssertionCreatorOrNull] is defined as `null` + * -- optionally the same assertions are created for the [otherKeyValues]. + * + * Delegates to `toContain.inAnyOrder.only.entries(keyValue, *otherKeyValues)` + * + * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.MapExpectationSamples.toContainOnlyKeyValue + * + * @since 0.17.0 + */ +inline fun > Expect.toContainOnly( + keyValue: KeyValue, + vararg otherKeyValues: KeyValue +): Expect = toContain.inAnyOrder.only.entries(keyValue, *otherKeyValues) + +/** + * Expects that the subject of `this` expectation (a [Map]) contains the key-value pairs of the given [mapLike]. + * + * Delegates to ` toContain.inAnyOrder.entriesOf` + * + * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.MapExpectationSamples.toContainEntriesOf + * + * @since 0.17.0 + */ +fun > Expect.toContainEntriesOf( + mapLike: MapLike +): Expect = toContain.inAnyOrder.entriesOf(mapLike) + +/** + * Expects that the subject of `this` expectation (a [Map]) contains only (in any order) the key-value pairs of + * the given [mapLike]. + * + * Delegates to `toContain.inAnyOrder.only.entriesOf` + * + * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.MapExpectationSamples.toContainOnlyEntriesOf + * + * @since 0.17.0 + */ +fun > Expect.toContainOnlyEntriesOf( + mapLike: MapLike +): Expect = toContain.inAnyOrder.only.entriesOf(mapLike) + +/** + * Expects that the subject of `this` expectation (a [Map]) contains the given [key]. + * + * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.MapExpectationSamples.toContainKey + * + * @since 0.17.0 + */ +fun > Expect.toContainKey(key: K): Expect = + _logicAppend { containsKey(::identity, key) } + +/** + * Expects that the subject of `this` expectation (a [Map]) does not contain the given [key]. + * + * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.MapExpectationSamples.notToContainKey + * + * @since 0.17.0 + */ +fun > Expect.notToContainKey(key: K): Expect = + _logicAppend { containsNotKey(::identity, key) } + +/** + * Expects that the subject of `this` expectation (a [Map]) is an empty [Map]. + * + * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.MapExpectationSamples.toBeEmpty + * + * @since 0.17.0 + */ +fun > Expect.toBeEmpty(): Expect = + _logicAppend { isEmpty(::toEntries) } + +/** + * Expects that the subject of `this` expectation (a [Map]) is not an empty [Map]. + * + * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.MapExpectationSamples.notToBeEmpty + * + * @since 0.17.0 + */ +fun > Expect.notToBeEmpty(): Expect = + _logicAppend { isNotEmpty(::toEntries) } + +private fun > toEntries(t: T): Collection<*> = t.entries diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderKeyValueExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderKeyValueExpectationsSpec.kt deleted file mode 100644 index d01af3a7b..000000000 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderKeyValueExpectationsSpec.kt +++ /dev/null @@ -1,236 +0,0 @@ -package ch.tutteli.atrium.api.fluent.en_GB - -import ch.tutteli.atrium.creating.Expect -import ch.tutteli.atrium.logic.utils.mapArguments -import ch.tutteli.atrium.specs.* -import ch.tutteli.atrium.specs.integration.mfun2 -import org.spekframework.spek2.Spek -import kotlin.jvm.JvmName -import ch.tutteli.atrium.api.fluent.en_GB.MapContainsInAnyOrderKeyValueExpectationsSpec.Companion as C - -class MapContainsInAnyOrderKeyValueExpectationsSpec : Spek({ - include(BuilderSpec) - include(ShortcutSpec) -}) { - - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderKeyValueExpectationsSpec( - functionDescription to C::containsKeyValues, - (functionDescription to C::containsKeyValuesNullable).withNullableSuffix(), - "[Atrium][Builder] " - ) - - object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderKeyValueExpectationsSpec( - mfun2.() -> Unit>(C::contains).adjustName { "$it ${KeyValue::class.simpleName}" }, - mfun2.() -> Unit)?>(C::contains).adjustName { "$it ${KeyValue::class.simpleName}" } - .withNullableSuffix(), - "[Atrium][Shortcut] " - ) - - companion object : MapContainsSpecBase() { - val functionDescription = "$contains.$inAnyOrder.$keyValue/$keyValues" - - private fun containsKeyValues( - expect: Expect>, - a: Pair.() -> Unit>, - aX: Array.() -> Unit>> - ): Expect> = - mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> - if (others.isEmpty()) expect.contains.inAnyOrder.entry(first) - else expect.contains.inAnyOrder.entries(first, *others) - } - - private fun containsKeyValuesNullable( - expect: Expect>, - a: Pair.() -> Unit)?>, - aX: Array.() -> Unit)?>> - ) = mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> - if (others.isEmpty()) expect.contains.inAnyOrder.entry(first) - else expect.contains.inAnyOrder.entries(first, *others) - } - - private fun contains( - expect: Expect>, - KeyValue: Pair.() -> Unit>, - otherKeyValues: Array.() -> Unit>> - ) = mapArguments(KeyValue, otherKeyValues).to { KeyValue(it.first, it.second) }.let { (first, others) -> - expect.contains(first, *others) - } - - @JvmName("containsNullable") - private fun contains( - expect: Expect>, - KeyValue: Pair.() -> Unit)?>, - otherKeyValues: Array.() -> Unit)?>> - ) = mapArguments(KeyValue, otherKeyValues).to { KeyValue(it.first, it.second) }.let { (first, others) -> - expect.contains(first, *others) - } - } - - @Suppress("unused", "UNUSED_VALUE") - private fun ambiguityTest() { - var map: Expect> = notImplemented() - var subMap: Expect> = notImplemented() - var nKeyMap: Expect> = notImplemented() - var nValueMap: Expect> = notImplemented() - var nKeyValueMap: Expect> = notImplemented() - var ronKeyValueMap: Expect> = notImplemented() - var starMap: Expect> = notImplemented() - - map = map.contains.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) - subMap = subMap.contains.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) - nKeyMap = nKeyMap.contains.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) - nValueMap = nValueMap.contains.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) - starMap = starMap.contains.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) - - map = map.contains.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) - subMap = subMap.contains.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) - nKeyMap = nKeyMap.contains.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) - nValueMap = nValueMap.contains.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) - starMap = starMap.contains.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) - - map = map.contains.inAnyOrder.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - subMap = subMap.contains.inAnyOrder.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nKeyMap = nKeyMap.contains.inAnyOrder.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nValueMap = nValueMap.contains.inAnyOrder.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - starMap = starMap.contains.inAnyOrder.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - - nKeyMap = nKeyMap.contains.inAnyOrder.entry(KeyValue(null) { toEqual("a") }) - nKeyMap = nKeyMap.contains.inAnyOrder.entry(KeyValue(null) { toEqual("a") }) - nValueMap = nValueMap.contains.inAnyOrder.entry(KeyValue(1.2, null)) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entry(KeyValue(null) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entry(KeyValue(null, null)) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entry(KeyValue(null) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entry(KeyValue(null, null)) - starMap = starMap.contains.inAnyOrder.entry(KeyValue(null) { toEqual("a") }) - starMap = starMap.contains.inAnyOrder.entry(KeyValue(null, null)) - - nKeyMap = nKeyMap.contains.inAnyOrder.entries(KeyValue(null) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entries(KeyValue(null) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entries(KeyValue(null) { toEqual("a") }) - starMap = starMap.contains.inAnyOrder.entries(KeyValue(null) { toEqual("a") }) - - nKeyMap = nKeyMap.contains.inAnyOrder.entries(KeyValue(null) { toEqual("a") }) - nValueMap = nValueMap.contains.inAnyOrder.entries(KeyValue(1, null), KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entries( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entries( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - starMap = starMap.contains.inAnyOrder.entries( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - - /// ------------- shortcuts ----------------------------------------------------------------- - - map = map.contains(KeyValue(1) { toEqual("a") }) - subMap = subMap.contains(KeyValue(1) { toEqual("a") }) - nKeyMap = nKeyMap.contains(KeyValue(1) { toEqual("a") }) - nValueMap = nValueMap.contains(KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains(KeyValue(1) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains(KeyValue(1) { toEqual("a") }) - starMap = starMap.contains(KeyValue(1) { toEqual("a") }) - - map = map.contains(KeyValue(1) { toEqual("a") }) - subMap = subMap.contains(KeyValue(1) { toEqual("a") }) - nKeyMap = nKeyMap.contains(KeyValue(1) { toEqual("a") }) - nValueMap = nValueMap.contains(KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains(KeyValue(1) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains(KeyValue(1) { toEqual("a") }) - starMap = starMap.contains(KeyValue(1) { toEqual("a") }) - - map = map.contains( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - subMap = subMap.contains( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nKeyMap = nKeyMap.contains( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nValueMap = nValueMap.contains( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nKeyValueMap = nKeyValueMap.contains( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - ronKeyValueMap = ronKeyValueMap.contains( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - starMap = starMap.contains( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - - nKeyMap = nKeyMap.contains(KeyValue(null) { toEqual("a") }) - nValueMap = nValueMap.contains(KeyValue(1.2, null)) - nKeyValueMap = nKeyValueMap.contains(KeyValue(null) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains(KeyValue(null, null)) - ronKeyValueMap = ronKeyValueMap.contains(KeyValue(null) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains(KeyValue(null, null)) - starMap = starMap.contains(KeyValue(null) { toEqual("a") }) - starMap = starMap.contains(KeyValue(null, null)) - - nKeyMap = nKeyMap.contains(KeyValue(null) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains(KeyValue(null) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains(KeyValue(null) { toEqual("a") }) - starMap = starMap.contains(KeyValue(null) { toEqual("a") }) - - nKeyMap = nKeyMap.contains(KeyValue(null) { toEqual("a") }) - nValueMap = nValueMap.contains(KeyValue(1, null), KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - ronKeyValueMap = ronKeyValueMap.contains( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - starMap = starMap.contains( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - } -} diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderKeyValuePairsExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderKeyValuePairsExpectationsSpec.kt deleted file mode 100644 index b0d7ea8ff..000000000 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderKeyValuePairsExpectationsSpec.kt +++ /dev/null @@ -1,152 +0,0 @@ -package ch.tutteli.atrium.api.fluent.en_GB - -import ch.tutteli.atrium.creating.Expect -import ch.tutteli.atrium.specs.* -import ch.tutteli.atrium.specs.integration.mfun2 -import org.spekframework.spek2.Spek -import ch.tutteli.atrium.api.fluent.en_GB.MapContainsInAnyOrderKeyValuePairsExpectationsSpec.Companion as C - -class MapContainsInAnyOrderKeyValuePairsExpectationsSpec : Spek({ - include(BuilderSpec) - include(ShortcutSpec) -}) { - - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderKeyValuePairsExpectationsSpec( - functionDescription to C::containsKeyValuePairs, - (functionDescription to C::containsKeyValuePairsNullable).withNullableSuffix(), - "[Atrium][Builder] " - ) - - object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderKeyValuePairsExpectationsSpec( - mfun2(Expect>::contains), - mfun2(Expect>::contains).withNullableSuffix(), - "[Atrium][Shortcut] " - ) - - companion object : MapContainsSpecBase() { - val functionDescription = "$contains.$inAnyOrder.$keyValuePair/$keyValuePairs" - - private fun containsKeyValuePairs( - expect: Expect>, - a: Pair, - aX: Array> - ): Expect> = - if (aX.isEmpty()) expect.contains.inAnyOrder.entry(a) - else expect.contains.inAnyOrder.entries(a, *aX) - - private fun containsKeyValuePairsNullable( - expect: Expect>, - a: Pair, - aX: Array> - ): Expect> = - if (aX.isEmpty()) expect.contains.inAnyOrder.entry(a) - else expect.contains.inAnyOrder.entries(a, *aX) - } - - @Suppress("unused", "UNUSED_VALUE") - private fun ambiguityTest() { - var map: Expect> = notImplemented() - var subMap: Expect> = notImplemented() - var nKeyMap: Expect> = notImplemented() - var nValueMap: Expect> = notImplemented() - var nKeyValueMap: Expect> = notImplemented() - var ronKeyValueMap: Expect> = notImplemented() - var starMap: Expect> = notImplemented() - - map = map.contains.inAnyOrder.entry(1 to "a") - subMap = subMap.contains.inAnyOrder.entry(1 to "a") - nKeyMap = nKeyMap.contains.inAnyOrder.entry(1 to "a") - nValueMap = nValueMap.contains.inAnyOrder.entry(1 to "a") - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entry(1 to "a") - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entry(1 to "a") - starMap = starMap.contains.inAnyOrder.entry(1 to "a") - - map = map.contains.inAnyOrder.entries(1 to "a") - subMap = subMap.contains.inAnyOrder.entries(1 to "a") - nKeyMap = nKeyMap.contains.inAnyOrder.entries(1 to "a") - nValueMap = nValueMap.contains.inAnyOrder.entries(1 to "a") - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entries(1 to "a") - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entries(1 to "a") - starMap = starMap.contains.inAnyOrder.entries(1 to "a") - - map = map.contains.inAnyOrder.entries( - 1 as Number to "a", - 1.2 to "b" - ) - subMap = subMap.contains.inAnyOrder.entries( - 1 as Number to "a", - 1.2 to "b" - ) - nKeyMap = nKeyMap.contains.inAnyOrder.entries( - 1 as Number to "a", - 1.2 to "b" - ) - nValueMap = nValueMap.contains.inAnyOrder.entries( - 1 as Number to "a", - 1.2 to "b" - ) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entries( - 1 as Number to "a", - 1.2 to "b" - ) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entries( - 1 as Number to "a", - 1.2 to "b" - ) - starMap = starMap.contains.inAnyOrder.entries( - 1 as Number to "a", - 1.2 to "b" - ) - - nKeyMap = nKeyMap.contains.inAnyOrder.entry(null to "a") - nValueMap = nValueMap.contains.inAnyOrder.entry(1.2 to null) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entry(null to null) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entry(null to null) - starMap = starMap.contains.inAnyOrder.entry(null to null) - - nKeyMap = nKeyMap.contains.inAnyOrder.entries(null to "a", 1 to "b") - nValueMap = nValueMap.contains.inAnyOrder.entries(1 to null) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entries((null to "a"), null to null, 1 to null) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entries((null to "a"), null to null, 1 to null) - starMap = starMap.contains.inAnyOrder.entries((null to "a"), null to null, 1 to null) - - - /// ------------- shortcuts ----------------------------------------------------------------- - - map = map.contains(1 to "a") - subMap = subMap.contains(1 to "a") - nKeyMap = nKeyMap.contains(1 to "a") - nValueMap = nValueMap.contains(1 to "a") - nKeyValueMap = nKeyValueMap.contains(1 to "a") - ronKeyValueMap = ronKeyValueMap.contains(1 to "a") - starMap = starMap.contains(1 to "a") - - map = map.contains(1 to "a") - subMap = subMap.contains(1 to "a") - nKeyMap = nKeyMap.contains(1 to "a") - nValueMap = nValueMap.contains(1 to "a") - nKeyValueMap = nKeyValueMap.contains(1 to "a") - ronKeyValueMap = ronKeyValueMap.contains(1 to "a") - starMap = starMap.contains(1 to "a") - - map = map.contains(1 as Number to "a", 1.2 to "b") - subMap = subMap.contains(1 as Number to "a", 1.2 to "b") - nKeyMap = nKeyMap.contains(1 as Number to "a", 1.2 to "b") - nValueMap = nValueMap.contains(1 as Number to "a", 1.2 to "b") - nKeyValueMap = nKeyValueMap.contains(1 as Number to "a", 1.2 to "b") - ronKeyValueMap = ronKeyValueMap.contains(1 as Number to "a", 1.2 to "b") - starMap = starMap.contains(1 as Number to "a", 1.2 to "b") - - nKeyMap = nKeyMap.contains(null to "a") - nValueMap = nValueMap.contains(1.2 to null) - nKeyValueMap = nKeyValueMap.contains(null to null) - ronKeyValueMap = ronKeyValueMap.contains(null to "a") - starMap = starMap.contains(null to "a") - - nKeyMap = nKeyMap.contains(null to "a") - nValueMap = nValueMap.contains(1.2 to null, 1 to null) - nKeyValueMap = nKeyValueMap.contains(null to "a", null to null, 1 to null) - ronKeyValueMap = ronKeyValueMap.contains(null to "a", null to null, 1 to null) - starMap = starMap.contains(null to "a", null to null, 1 to null) - } -} diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderOnlyKeyValueExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderOnlyKeyValueExpectationsSpec.kt deleted file mode 100644 index cf2c085ca..000000000 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderOnlyKeyValueExpectationsSpec.kt +++ /dev/null @@ -1,238 +0,0 @@ -package ch.tutteli.atrium.api.fluent.en_GB - -import ch.tutteli.atrium.creating.Expect -import ch.tutteli.atrium.logic.utils.mapArguments -import ch.tutteli.atrium.specs.* -import ch.tutteli.atrium.specs.integration.mfun2 -import org.spekframework.spek2.Spek -import kotlin.jvm.JvmName -import ch.tutteli.atrium.api.fluent.en_GB.MapContainsInAnyOrderOnlyKeyValueExpectationsSpec.Companion as C - -class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec : Spek({ - include(BuilderSpec) - include(ShortcutSpec) -}) { - - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( - functionDescription to C::containsKeyValues, - (functionDescription to C::containsKeyValuesNullable).withNullableSuffix(), - "[Atrium][Builder] " - ) - - - object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( - mfun2.() -> Unit>(C::containsOnly), - mfun2.() -> Unit)?>(C::containsOnly).withNullableSuffix(), - "[Atrium][Shortcut] " - ) - - companion object : MapContainsSpecBase() { - val functionDescription = "$contains.$inAnyOrder.$only.$keyValue/$keyValues" - - private fun containsKeyValues( - expect: Expect>, - a: Pair.() -> Unit>, - aX: Array.() -> Unit>> - ) = mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> - if (others.isEmpty()) expect.contains.inAnyOrder.only.entry(first) - else expect.contains.inAnyOrder.only.entries(first, *others) - } - - private fun containsKeyValuesNullable( - expect: Expect>, - a: Pair.() -> Unit)?>, - aX: Array.() -> Unit)?>> - ) = mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> - if (others.isEmpty()) expect.contains.inAnyOrder.only.entry(first) - else expect.contains.inAnyOrder.only.entries(first, *others) - } - - private fun containsOnly( - expect: Expect>, - a: Pair.() -> Unit>, - aX: Array.() -> Unit>> - ): Expect> = - mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> - expect.containsOnly(first, *others) - } - - @JvmName("containsInAnyOrderOnlyNullable") - private fun containsOnly( - expect: Expect>, - a: Pair.() -> Unit)?>, - aX: Array.() -> Unit)?>> - ): Expect> = - mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> - expect.containsOnly(first, *others) - } - } - - - @Suppress("unused", "UNUSED_VALUE") - private fun ambiguityTest() { - var map: Expect> = notImplemented() - var subMap: Expect> = notImplemented() - var nKeyMap: Expect> = notImplemented() - var nValueMap: Expect> = notImplemented() - var nKeyValueMap: Expect> = notImplemented() - var ronKeyValueMap: Expect> = notImplemented() - var starMap: Expect> = notImplemented() - - map = map.contains.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) - subMap = subMap.contains.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) - nKeyMap = nKeyMap.contains.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) - nValueMap = nValueMap.contains.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) - starMap = starMap.contains.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) - - map = map.contains.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) - subMap = subMap.contains.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) - nKeyMap = nKeyMap.contains.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) - nValueMap = nValueMap.contains.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) - starMap = starMap.contains.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) - - map = map.contains.inAnyOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - subMap = subMap.contains.inAnyOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nKeyMap = nKeyMap.contains.inAnyOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nValueMap = nValueMap.contains.inAnyOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - starMap = starMap.contains.inAnyOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - - nKeyMap = nKeyMap.contains.inAnyOrder.only.entry(KeyValue(null) { toEqual("a") }) - nKeyMap = nKeyMap.contains.inAnyOrder.only.entry(KeyValue(null) { toEqual("a") }) - nValueMap = nValueMap.contains.inAnyOrder.only.entry(KeyValue(1.2, null)) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entry(KeyValue(null) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entry(KeyValue(null, null)) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entry(KeyValue(null) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entry(KeyValue(null, null)) - starMap = starMap.contains.inAnyOrder.only.entry(KeyValue(null) { toEqual("a") }) - starMap = starMap.contains.inAnyOrder.only.entry(KeyValue(null, null)) - - nKeyMap = nKeyMap.contains.inAnyOrder.only.entries(KeyValue(null) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entries(KeyValue(null) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entries(KeyValue(null) { toEqual("a") }) - starMap = starMap.contains.inAnyOrder.only.entries(KeyValue(null) { toEqual("a") }) - - nKeyMap = nKeyMap.contains.inAnyOrder.only.entries(KeyValue(null) { toEqual("a") }) - nValueMap = nValueMap.contains.inAnyOrder.only.entries(KeyValue(1, null), KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entries( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entries( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - starMap = starMap.contains.inAnyOrder.only.entries( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - - /// ------------- shortcuts ----------------------------------------------------------------- - - map = map.containsOnly(KeyValue(1) { toEqual("a") }) - subMap = subMap.containsOnly(KeyValue(1) { toEqual("a") }) - nKeyMap = nKeyMap.containsOnly(KeyValue(1) { toEqual("a") }) - nValueMap = nValueMap.containsOnly(KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.containsOnly(KeyValue(1) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.containsOnly(KeyValue(1) { toEqual("a") }) - starMap = starMap.containsOnly(KeyValue(1) { toEqual("a") }) - - map = map.containsOnly(KeyValue(1) { toEqual("a") }) - subMap = subMap.containsOnly(KeyValue(1) { toEqual("a") }) - nKeyMap = nKeyMap.containsOnly(KeyValue(1) { toEqual("a") }) - nValueMap = nValueMap.containsOnly(KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.containsOnly(KeyValue(1) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.containsOnly(KeyValue(1) { toEqual("a") }) - starMap = starMap.containsOnly(KeyValue(1) { toEqual("a") }) - - map = map.containsOnly( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - subMap = subMap.containsOnly( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nKeyMap = nKeyMap.containsOnly( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nValueMap = nValueMap.containsOnly( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nKeyValueMap = nKeyValueMap.containsOnly( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - ronKeyValueMap = ronKeyValueMap.containsOnly( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - starMap = starMap.containsOnly( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - - nKeyMap = nKeyMap.containsOnly(KeyValue(null) { toEqual("a") }) - nValueMap = nValueMap.containsOnly(KeyValue(1.2, null)) - nKeyValueMap = nKeyValueMap.containsOnly(KeyValue(null) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.containsOnly(KeyValue(null, null)) - ronKeyValueMap = ronKeyValueMap.containsOnly(KeyValue(null) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.containsOnly(KeyValue(null, null)) - starMap = starMap.containsOnly(KeyValue(null) { toEqual("a") }) - starMap = starMap.containsOnly(KeyValue(null, null)) - - nKeyMap = nKeyMap.containsOnly(KeyValue(null) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.containsOnly(KeyValue(null) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.containsOnly(KeyValue(null) { toEqual("a") }) - starMap = starMap.containsOnly(KeyValue(null) { toEqual("a") }) - - nKeyMap = nKeyMap.containsOnly(KeyValue(null) { toEqual("a") }) - nValueMap = nValueMap.containsOnly(KeyValue(1, null), KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.containsOnly( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - ronKeyValueMap = ronKeyValueMap.containsOnly( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - starMap = starMap.containsOnly( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - } -} diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt deleted file mode 100644 index 25417e361..000000000 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt +++ /dev/null @@ -1,153 +0,0 @@ -package ch.tutteli.atrium.api.fluent.en_GB - -import ch.tutteli.atrium.creating.Expect -import ch.tutteli.atrium.specs.* -import ch.tutteli.atrium.specs.integration.mfun2 -import org.spekframework.spek2.Spek -import ch.tutteli.atrium.api.fluent.en_GB.MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec.Companion as C - -class MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec : Spek({ - include(BuilderSpec) - include(ShortcutSpec) -}) { - - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( - functionDescription to C::containsKeyValuePairs, - (functionDescription to C::containsKeyValuePairsNullable).withNullableSuffix(), - "[Atrium][Builder] " - ) - - object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( - mfun2(Expect>::containsOnly), - mfun2(Expect>::containsOnly).withNullableSuffix(), - "[Atrium][Shortcut] " - ) - - companion object : MapContainsSpecBase() { - val functionDescription = "$contains.$inAnyOrder.$only.$keyValuePair/$keyValuePairs" - - private fun containsKeyValuePairs( - expect: Expect>, - a: Pair, - aX: Array> - ): Expect> = - if (aX.isEmpty()) expect.contains.inAnyOrder.only.entry(a) - else expect.contains.inAnyOrder.only.entries(a, *aX) - - private fun containsKeyValuePairsNullable( - expect: Expect>, - a: Pair, - aX: Array> - ): Expect> = - if (aX.isEmpty()) expect.contains.inAnyOrder.only.entry(a) - else expect.contains.inAnyOrder.only.entries(a, *aX) - } - - - @Suppress("unused", "UNUSED_VALUE") - private fun ambiguityTest() { - var map: Expect> = notImplemented() - var subMap: Expect> = notImplemented() - var nKeyMap: Expect> = notImplemented() - var nValueMap: Expect> = notImplemented() - var nKeyValueMap: Expect> = notImplemented() - var ronKeyValueMap: Expect> = notImplemented() - var starMap: Expect> = notImplemented() - - map = map.contains.inAnyOrder.only.entry(1 to "a") - subMap = subMap.contains.inAnyOrder.only.entry(1 to "a") - nKeyMap = nKeyMap.contains.inAnyOrder.only.entry(1 to "a") - nValueMap = nValueMap.contains.inAnyOrder.only.entry(1 to "a") - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entry(1 to "a") - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entry(1 to "a") - starMap = starMap.contains.inAnyOrder.only.entry(1 to "a") - - map = map.contains.inAnyOrder.only.entries(1 to "a") - subMap = subMap.contains.inAnyOrder.only.entries(1 to "a") - nKeyMap = nKeyMap.contains.inAnyOrder.only.entries(1 to "a") - nValueMap = nValueMap.contains.inAnyOrder.only.entries(1 to "a") - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entries(1 to "a") - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entries(1 to "a") - starMap = starMap.contains.inAnyOrder.only.entries(1 to "a") - - map = map.contains.inAnyOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - subMap = subMap.contains.inAnyOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - nKeyMap = nKeyMap.contains.inAnyOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - nValueMap = nValueMap.contains.inAnyOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - starMap = starMap.contains.inAnyOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - - nKeyMap = nKeyMap.contains.inAnyOrder.only.entry(null to "a") - nValueMap = nValueMap.contains.inAnyOrder.only.entry(1.2 to null) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entry(null to null) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entry(null to null) - starMap = starMap.contains.inAnyOrder.only.entry(null to null) - - nKeyMap = nKeyMap.contains.inAnyOrder.only.entries(null to "a", 1 to "b") - nValueMap = nValueMap.contains.inAnyOrder.only.entries(1 to null) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entries((null to "a"), null to null, 1 to null) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entries((null to "a"), null to null, 1 to null) - starMap = starMap.contains.inAnyOrder.only.entries((null to "a"), null to null, 1 to null) - - - /// ------------- shortcuts ----------------------------------------------------------------- - - map = map.containsOnly(1 to "a") - subMap = subMap.containsOnly(1 to "a") - nKeyMap = nKeyMap.containsOnly(1 to "a") - nValueMap = nValueMap.containsOnly(1 to "a") - nKeyValueMap = nKeyValueMap.containsOnly(1 to "a") - ronKeyValueMap = ronKeyValueMap.containsOnly(1 to "a") - starMap = starMap.containsOnly(1 to "a") - - map = map.containsOnly(1 to "a") - subMap = subMap.containsOnly(1 to "a") - nKeyMap = nKeyMap.containsOnly(1 to "a") - nValueMap = nValueMap.containsOnly(1 to "a") - nKeyValueMap = nKeyValueMap.containsOnly(1 to "a") - ronKeyValueMap = ronKeyValueMap.containsOnly(1 to "a") - starMap = starMap.containsOnly(1 to "a") - - map = map.containsOnly(1 as Number to "a", 1.2 to "b") - subMap = subMap.containsOnly(1 as Number to "a", 1.2 to "b") - nKeyMap = nKeyMap.containsOnly(1 as Number to "a", 1.2 to "b") - nValueMap = nValueMap.containsOnly(1 as Number to "a", 1.2 to "b") - nKeyValueMap = nKeyValueMap.containsOnly(1 as Number to "a", 1.2 to "b") - ronKeyValueMap = ronKeyValueMap.containsOnly(1 as Number to "a", 1.2 to "b") - starMap = starMap.containsOnly(1 as Number to "a", 1.2 to "b") - - nKeyMap = nKeyMap.containsOnly(null to "a") - nValueMap = nValueMap.containsOnly(1.2 to null) - nKeyValueMap = nKeyValueMap.containsOnly(null to null) - ronKeyValueMap = ronKeyValueMap.containsOnly(null to "a") - starMap = starMap.containsOnly(null to "a") - - nKeyMap = nKeyMap.containsOnly(null to "a") - nValueMap = nValueMap.containsOnly(1.2 to null, 1 to null) - nKeyValueMap = nKeyValueMap.containsOnly(null to "a", null to null, 1 to null) - ronKeyValueMap = ronKeyValueMap.containsOnly(null to "a", null to null, 1 to null) - starMap = starMap.containsOnly(null to "a", null to null, 1 to null) - } -} diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInOrderOnlyKeyValueExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInOrderOnlyKeyValueExpectationsSpec.kt deleted file mode 100644 index 868b167be..000000000 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInOrderOnlyKeyValueExpectationsSpec.kt +++ /dev/null @@ -1,130 +0,0 @@ -package ch.tutteli.atrium.api.fluent.en_GB - -import ch.tutteli.atrium.creating.Expect -import ch.tutteli.atrium.logic.utils.mapArguments -import ch.tutteli.atrium.specs.notImplemented -import ch.tutteli.atrium.specs.withNullableSuffix -import org.spekframework.spek2.Spek -import ch.tutteli.atrium.api.fluent.en_GB.MapContainsInOrderOnlyKeyValueExpectationsSpec.Companion as C - -class MapContainsInOrderOnlyKeyValueExpectationsSpec : Spek({ - include(BuilderSpec) -}) { - - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInOrderOnlyKeyValueExpectationsSpec( - functionDescription to C::containsKeyValues, - (functionDescription to C::containsKeyValuesNullable).withNullableSuffix(), - "[Atrium][Builder] " - ) - - companion object : MapContainsSpecBase() { - val functionDescription = "$contains.$inOrder.$only.$keyValue/$keyValues" - - private fun containsKeyValues( - expect: Expect>, - a: Pair.() -> Unit>, - aX: Array.() -> Unit>> - ) = mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> - if (others.isEmpty()) expect.contains.inOrder.only.entry(first) - else expect.contains.inOrder.only.entries(first, *others) - } - - private fun containsKeyValuesNullable( - expect: Expect>, - a: Pair.() -> Unit)?>, - aX: Array.() -> Unit)?>> - ) = mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> - if (others.isEmpty()) expect.contains.inOrder.only.entry(first) - else expect.contains.inOrder.only.entries(first, *others) - } - } - - @Suppress("unused", "UNUSED_VALUE") - private fun ambiguityTest() { - var map: Expect> = notImplemented() - var subMap: Expect> = notImplemented() - var nKeyMap: Expect> = notImplemented() - var nValueMap: Expect> = notImplemented() - var nKeyValueMap: Expect> = notImplemented() - var ronKeyValueMap: Expect> = notImplemented() - var starMap: Expect> = notImplemented() - - map = map.contains.inOrder.only.entry(KeyValue(1) { toEqual("a") }) - subMap = subMap.contains.inOrder.only.entry(KeyValue(1) { toEqual("a") }) - nKeyMap = nKeyMap.contains.inOrder.only.entry(KeyValue(1) { toEqual("a") }) - nValueMap = nValueMap.contains.inOrder.only.entry(KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entry(KeyValue(1) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entry(KeyValue(1) { toEqual("a") }) - starMap = starMap.contains.inOrder.only.entry(KeyValue(1) { toEqual("a") }) - - map = map.contains.inOrder.only.entries(KeyValue(1) { toEqual("a") }) - subMap = subMap.contains.inOrder.only.entries(KeyValue(1) { toEqual("a") }) - nKeyMap = nKeyMap.contains.inOrder.only.entries(KeyValue(1) { toEqual("a") }) - nValueMap = nValueMap.contains.inOrder.only.entries(KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entries(KeyValue(1) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entries(KeyValue(1) { toEqual("a") }) - starMap = starMap.contains.inOrder.only.entries(KeyValue(1) { toEqual("a") }) - - map = map.contains.inOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - subMap = subMap.contains.inOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nKeyMap = nKeyMap.contains.inOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nValueMap = nValueMap.contains.inOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - starMap = starMap.contains.inOrder.only.entries( - KeyValue(1 as Number) { toEqual("a") }, - KeyValue(1.2) { toEqual("b") } - ) - - nKeyMap = nKeyMap.contains.inOrder.only.entry(KeyValue(null) { toEqual("a") }) - nKeyMap = nKeyMap.contains.inOrder.only.entry(KeyValue(null) { toEqual("a") }) - nValueMap = nValueMap.contains.inOrder.only.entry(KeyValue(1.2, null)) - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entry(KeyValue(null) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entry(KeyValue(null, null)) - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entry(KeyValue(null) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entry(KeyValue(null, null)) - starMap = starMap.contains.inOrder.only.entry(KeyValue(null) { toEqual("a") }) - starMap = starMap.contains.inOrder.only.entry(KeyValue(null, null)) - - nKeyMap = nKeyMap.contains.inOrder.only.entries(KeyValue(null) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entries(KeyValue(null) { toEqual("a") }) - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entries(KeyValue(null) { toEqual("a") }) - starMap = starMap.contains.inOrder.only.entries(KeyValue(null) { toEqual("a") }) - - nKeyMap = nKeyMap.contains.inOrder.only.entries(KeyValue(null) { toEqual("a") }) - nValueMap = nValueMap.contains.inOrder.only.entries(KeyValue(1, null), KeyValue(1) { toEqual("a") }) - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entries( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entries( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - starMap = starMap.contains.inOrder.only.entries( - KeyValue(null) { toEqual("a") }, - KeyValue(null, null), - KeyValue(1, null) - ) - } -} diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInOrderOnlyKeyValuePairsExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInOrderOnlyKeyValuePairsExpectationsSpec.kt deleted file mode 100644 index e3da4da54..000000000 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInOrderOnlyKeyValuePairsExpectationsSpec.kt +++ /dev/null @@ -1,107 +0,0 @@ -package ch.tutteli.atrium.api.fluent.en_GB - -import ch.tutteli.atrium.creating.Expect -import ch.tutteli.atrium.specs.notImplemented -import ch.tutteli.atrium.specs.withNullableSuffix -import org.spekframework.spek2.Spek -import ch.tutteli.atrium.api.fluent.en_GB.MapContainsInOrderOnlyKeyValuePairsExpectationsSpec.Companion as C - -class MapContainsInOrderOnlyKeyValuePairsExpectationsSpec : Spek({ - include(BuilderSpec) -}) { - - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInOrderOnlyKeyValuePairsExpectationsSpec( - functionDescription to C::containsKeyValuePairs, - (functionDescription to C::containsKeyValuePairsNullable).withNullableSuffix(), - "[Atrium][Builder] " - ) - - companion object : MapContainsSpecBase() { - val functionDescription = "$contains.$inOrder.$only.$keyValuePair/$keyValuePairs" - - private fun containsKeyValuePairs( - expect: Expect>, - a: Pair, - aX: Array> - ): Expect> = - if (aX.isEmpty()) expect.contains.inOrder.only.entry(a) - else expect.contains.inOrder.only.entries(a, *aX) - - private fun containsKeyValuePairsNullable( - expect: Expect>, - a: Pair, - aX: Array> - ): Expect> = - if (aX.isEmpty()) expect.contains.inOrder.only.entry(a) - else expect.contains.inOrder.only.entries(a, *aX) - } - - - @Suppress("unused", "UNUSED_VALUE") - private fun ambiguityTest() { - var map: Expect> = notImplemented() - var subMap: Expect> = notImplemented() - var nKeyMap: Expect> = notImplemented() - var nValueMap: Expect> = notImplemented() - var nKeyValueMap: Expect> = notImplemented() - var ronKeyValueMap: Expect> = notImplemented() - var starMap: Expect> = notImplemented() - - map = map.contains.inOrder.only.entry(1 to "a") - subMap = subMap.contains.inOrder.only.entry(1 to "a") - nKeyMap = nKeyMap.contains.inOrder.only.entry(1 to "a") - nValueMap = nValueMap.contains.inOrder.only.entry(1 to "a") - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entry(1 to "a") - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entry(1 to "a") - starMap = starMap.contains.inOrder.only.entry(1 to "a") - - map = map.contains.inOrder.only.entries(1 to "a") - subMap = subMap.contains.inOrder.only.entries(1 to "a") - nKeyMap = nKeyMap.contains.inOrder.only.entries(1 to "a") - nValueMap = nValueMap.contains.inOrder.only.entries(1 to "a") - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entries(1 to "a") - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entries(1 to "a") - starMap = starMap.contains.inOrder.only.entries(1 to "a") - - map = map.contains.inOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - subMap = subMap.contains.inOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - nKeyMap = nKeyMap.contains.inOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - nValueMap = nValueMap.contains.inOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - starMap = starMap.contains.inOrder.only.entries( - 1 as Number to "a", - 1.2 to "b" - ) - - nKeyMap = nKeyMap.contains.inOrder.only.entry(null to "a") - nValueMap = nValueMap.contains.inOrder.only.entry(1.2 to null) - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entry(null to null) - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entry(null to null) - starMap = starMap.contains.inOrder.only.entry(null to null) - - nKeyMap = nKeyMap.contains.inOrder.only.entries(null to "a", 1 to "b") - nValueMap = nValueMap.contains.inOrder.only.entries(1 to null) - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entries((null to "a"), null to null, 1 to null) - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entries((null to "a"), null to null, 1 to null) - starMap = starMap.contains.inOrder.only.entries((null to "a"), null to null, 1 to null) - } -} diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapExpectationsSpec.kt index d43903dd2..70c2257c3 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapExpectationsSpec.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapExpectationsSpec.kt @@ -6,16 +6,16 @@ import ch.tutteli.atrium.specs.* import kotlin.jvm.JvmName class MapExpectationsSpec : ch.tutteli.atrium.specs.integration.MapExpectationsSpec( - fun1(Expect>::containsKey), - fun1(Expect>::containsKey).withNullableSuffix(), - fun1(Expect>::containsNotKey), - fun1(Expect>::containsNotKey).withNullableSuffix(), + fun1(Expect>::toContainKey), + fun1(Expect>::toContainKey).withNullableSuffix(), + fun1(Expect>::notToContainKey), + fun1(Expect>::notToContainKey).withNullableSuffix(), feature1, String, Int>(Expect>::getExisting), fun2, String, Expect.() -> Unit>(Expect>::getExisting), feature1, String?, Int?>(Expect>::getExisting).withNullableSuffix(), fun2, String?, Expect.() -> Unit>(Expect>::getExisting).withNullableSuffix(), - fun0(Expect>::isEmpty), - fun0(Expect>::isNotEmpty), + fun0(Expect>::toBeEmpty), + fun0(Expect>::notToBeEmpty), fun1, Expect>.() -> Unit>(Expect>::keys), property, Set>(Expect>::keys), property, Collection>(Expect>::values), @@ -23,21 +23,21 @@ class MapExpectationsSpec : ch.tutteli.atrium.specs.integration.MapExpectationsS ) { companion object { - private fun contains( + private fun toContain( expect: Expect>, keyValue: Pair.() -> Unit>, otherKeyValues: Array.() -> Unit>> ) = mapArguments.() -> Unit>>(keyValue, otherKeyValues).to { KeyValue(it.first, it.second) }.let { (first, others) -> - expect.contains(first, *others) + expect.toContain(first, *others) } - @JvmName("containsNullable") - private fun contains( + @JvmName("toContainNullable") + private fun toContain( expect: Expect>, keyValue: Pair.() -> Unit)?>, otherKeyValues: Array.() -> Unit)?>> ) = mapArguments(keyValue, otherKeyValues).to { KeyValue(it.first, it.second) }.let { (first, others) -> - expect.contains(first, *others) + expect.toContain(first, *others) } } @@ -52,39 +52,39 @@ class MapExpectationsSpec : ch.tutteli.atrium.specs.integration.MapExpectationsS var readOnlyNullableKeyValueMap: Expect> = notImplemented() var starMap: Expect> = notImplemented() - map.containsKey(1) - map.containsKey(1f) - subMap.containsKey(1) - subMap.containsKey(1f) - nullableKeyMap.containsKey(1) - nullableKeyMap.containsKey(1f) - readOnlyNullableKeyValueMap.containsKey(1) - readOnlyNullableKeyValueMap.containsKey(1f) + map.toContainKey(1) + map.toContainKey(1f) + subMap.toContainKey(1) + subMap.toContainKey(1f) + nullableKeyMap.toContainKey(1) + nullableKeyMap.toContainKey(1f) + readOnlyNullableKeyValueMap.toContainKey(1) + readOnlyNullableKeyValueMap.toContainKey(1f) - map.containsNotKey(1) - map.containsNotKey(1f) - subMap.containsNotKey(1) - subMap.containsNotKey(1f) - nullableKeyMap.containsNotKey(1) - nullableKeyMap.containsNotKey(1f) - readOnlyNullableKeyValueMap.containsNotKey(1) - readOnlyNullableKeyValueMap.containsNotKey(1f) + map.notToContainKey(1) + map.notToContainKey(1f) + subMap.notToContainKey(1) + subMap.notToContainKey(1f) + nullableKeyMap.notToContainKey(1) + nullableKeyMap.notToContainKey(1f) + readOnlyNullableKeyValueMap.notToContainKey(1) + readOnlyNullableKeyValueMap.notToContainKey(1f) - map = map.isEmpty() - subMap = subMap.isEmpty() - nullableKeyMap = nullableKeyMap.isEmpty() - nullableValueMap = nullableValueMap.isEmpty() - nullableKeyValueMap = nullableKeyValueMap.isEmpty() - readOnlyNullableKeyValueMap = readOnlyNullableKeyValueMap.isEmpty() - starMap = starMap.isEmpty() + map = map.toBeEmpty() + subMap = subMap.toBeEmpty() + nullableKeyMap = nullableKeyMap.toBeEmpty() + nullableValueMap = nullableValueMap.toBeEmpty() + nullableKeyValueMap = nullableKeyValueMap.toBeEmpty() + readOnlyNullableKeyValueMap = readOnlyNullableKeyValueMap.toBeEmpty() + starMap = starMap.toBeEmpty() - map = map.isNotEmpty() - subMap = subMap.isNotEmpty() - nullableKeyMap = nullableKeyMap.isNotEmpty() - nullableValueMap = nullableValueMap.isNotEmpty() - nullableKeyValueMap = nullableKeyValueMap.isNotEmpty() - readOnlyNullableKeyValueMap = readOnlyNullableKeyValueMap.isNotEmpty() - starMap = starMap.isNotEmpty() + map = map.notToBeEmpty() + subMap = subMap.notToBeEmpty() + nullableKeyMap = nullableKeyMap.notToBeEmpty() + nullableValueMap = nullableValueMap.notToBeEmpty() + nullableKeyValueMap = nullableKeyValueMap.notToBeEmpty() + readOnlyNullableKeyValueMap = readOnlyNullableKeyValueMap.notToBeEmpty() + starMap = starMap.notToBeEmpty() map.keys subMap.keys diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderEntriesOfExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderEntriesOfExpectationsSpec.kt similarity index 53% rename from apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderEntriesOfExpectationsSpec.kt rename to apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderEntriesOfExpectationsSpec.kt index a4281d87c..ef6816965 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderEntriesOfExpectationsSpec.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderEntriesOfExpectationsSpec.kt @@ -7,24 +7,24 @@ import ch.tutteli.atrium.specs.notImplemented import ch.tutteli.atrium.specs.withNullableSuffix import org.spekframework.spek2.Spek import kotlin.jvm.JvmName -import ch.tutteli.atrium.api.fluent.en_GB.MapContainsInAnyOrderEntriesOfExpectationsSpec.Companion as C +import ch.tutteli.atrium.api.fluent.en_GB.MapToContainInAnyOrderEntriesOfExpectationsSpec.Companion as C -class MapContainsInAnyOrderEntriesOfExpectationsSpec : Spek({ +class MapToContainInAnyOrderEntriesOfExpectationsSpec : Spek({ include(BuilderSpec) include(ShortcutSpec) include(BuilderMapLikeToIterablePairSpec) include(ShortcutMapLikeToIterablePairSpec) }) { - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderKeyValuePairsExpectationsSpec( - functionDescription to C::containsKeyValuePairs, - (functionDescription to C::containsKeyValuePairsNullable).withNullableSuffix(), + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderKeyValuePairsExpectationsSpec( + functionDescription to C::toContainKeyValuePairs, + (functionDescription to C::toContainKeyValuePairsNullable).withNullableSuffix(), "[Atrium][Builder] " ) - object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderKeyValuePairsExpectationsSpec( - mfun2(C::containsEntriesOf), - mfun2(C::containsEntriesOf).withNullableSuffix(), + object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderKeyValuePairsExpectationsSpec( + mfun2(C::toContainEntriesOf), + mfun2(C::toContainEntriesOf).withNullableSuffix(), "[Atrium][Shortcut] " ) @@ -32,20 +32,20 @@ class MapContainsInAnyOrderEntriesOfExpectationsSpec : Spek({ ch.tutteli.atrium.specs.integration.MapLikeToIterablePairSpec>( functionDescription, mapOf("a" to 1), - { input -> contains.inAnyOrder.entriesOf(input) } + { input -> toContain.inAnyOrder.entriesOf(input) } ) object ShortcutMapLikeToIterablePairSpec : ch.tutteli.atrium.specs.integration.MapLikeToIterablePairSpec>( - containsEntriesOf, + toContainEntriesOf, mapOf("a" to 1), - { input -> containsEntriesOf(input) } + { input -> toContainEntriesOf(input) } ) - companion object : MapContainsSpecBase() { - val functionDescription = "$contains.$inAnyOrder.$entriesOf" + companion object : MapToContainSpecBase() { + val functionDescription = "$toContain.$inAnyOrder.$entriesOf" - private fun containsKeyValuePairs( + private fun toContainKeyValuePairs( expect: Expect>, a: Pair, aX: Array> @@ -55,30 +55,30 @@ class MapContainsInAnyOrderEntriesOfExpectationsSpec : Spek({ } else { mapOf(a, *aX) } - return expect.contains.inAnyOrder.entriesOf(mapLike) + return expect.toContain.inAnyOrder.entriesOf(mapLike) } - private fun containsKeyValuePairsNullable( + private fun toContainKeyValuePairsNullable( expect: Expect>, a: Pair, aX: Array> ): Expect> = - expect.contains.inAnyOrder.entriesOf(listOf(a, *aX)) + expect.toContain.inAnyOrder.entriesOf(listOf(a, *aX)) - private fun containsEntriesOf( + private fun toContainEntriesOf( expect: Expect>, a: Pair, aX: Array> ): Expect> = - expect.containsEntriesOf(sequenceOf(a, *aX)) + expect.toContainEntriesOf(sequenceOf(a, *aX)) - @JvmName("containsNullable") - private fun containsEntriesOf( + @JvmName("toContainNullable") + private fun toContainEntriesOf( expect: Expect>, a: Pair, aX: Array> ): Expect> = - expect.containsEntriesOf(arrayOf(a, *aX)) + expect.toContainEntriesOf(arrayOf(a, *aX)) } @@ -92,20 +92,20 @@ class MapContainsInAnyOrderEntriesOfExpectationsSpec : Spek({ var ronKeyValueMap: Expect> = notImplemented() var starMap: Expect> = notImplemented() - map = map.contains.inAnyOrder.entriesOf(listOf(1 to "a")) - subMap = subMap.contains.inAnyOrder.entriesOf(listOf(1 to "a")) - nKeyMap = nKeyMap.contains.inAnyOrder.entriesOf(listOf(1 to "a")) - nValueMap = nValueMap.contains.inAnyOrder.entriesOf(listOf(1 to "a")) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.entriesOf(listOf(1 to "a")) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.entriesOf(listOf(1 to "a")) - starMap = starMap.contains.inAnyOrder.entriesOf(listOf(1 to "a")) + map = map.toContain.inAnyOrder.entriesOf(listOf(1 to "a")) + subMap = subMap.toContain.inAnyOrder.entriesOf(listOf(1 to "a")) + nKeyMap = nKeyMap.toContain.inAnyOrder.entriesOf(listOf(1 to "a")) + nValueMap = nValueMap.toContain.inAnyOrder.entriesOf(listOf(1 to "a")) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entriesOf(listOf(1 to "a")) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entriesOf(listOf(1 to "a")) + starMap = starMap.toContain.inAnyOrder.entriesOf(listOf(1 to "a")) - map = map.containsEntriesOf(listOf(1 to "a")) - subMap = subMap.containsEntriesOf(listOf(1 to "a")) - nKeyMap = nKeyMap.containsEntriesOf(listOf(1 to "a")) - nValueMap = nValueMap.containsEntriesOf(listOf(1 to "a")) - nKeyValueMap = nKeyValueMap.containsEntriesOf(listOf(1 to "a")) - ronKeyValueMap = ronKeyValueMap.containsEntriesOf(listOf(1 to "a")) - starMap = starMap.containsEntriesOf(listOf(1 to "a")) + map = map.toContainEntriesOf(listOf(1 to "a")) + subMap = subMap.toContainEntriesOf(listOf(1 to "a")) + nKeyMap = nKeyMap.toContainEntriesOf(listOf(1 to "a")) + nValueMap = nValueMap.toContainEntriesOf(listOf(1 to "a")) + nKeyValueMap = nKeyValueMap.toContainEntriesOf(listOf(1 to "a")) + ronKeyValueMap = ronKeyValueMap.toContainEntriesOf(listOf(1 to "a")) + starMap = starMap.toContainEntriesOf(listOf(1 to "a")) } } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderKeyValueExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderKeyValueExpectationsSpec.kt new file mode 100644 index 000000000..63b38c694 --- /dev/null +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderKeyValueExpectationsSpec.kt @@ -0,0 +1,236 @@ +package ch.tutteli.atrium.api.fluent.en_GB + +import ch.tutteli.atrium.creating.Expect +import ch.tutteli.atrium.logic.utils.mapArguments +import ch.tutteli.atrium.specs.* +import ch.tutteli.atrium.specs.integration.mfun2 +import org.spekframework.spek2.Spek +import kotlin.jvm.JvmName +import ch.tutteli.atrium.api.fluent.en_GB.MapToContainInAnyOrderKeyValueExpectationsSpec.Companion as C + +class MapToContainInAnyOrderKeyValueExpectationsSpec : Spek({ + include(BuilderSpec) + include(ShortcutSpec) +}) { + + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderKeyValueExpectationsSpec( + functionDescription to C::toContainKeyValues, + (functionDescription to C::toContainKeyValuesNullable).withNullableSuffix(), + "[Atrium][Builder] " + ) + + object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderKeyValueExpectationsSpec( + mfun2.() -> Unit>(C::toContain).adjustName { "$it ${KeyValue::class.simpleName}" }, + mfun2.() -> Unit)?>(C::toContain).adjustName { "$it ${KeyValue::class.simpleName}" } + .withNullableSuffix(), + "[Atrium][Shortcut] " + ) + + companion object : MapToContainSpecBase() { + val functionDescription = "$toContain.$inAnyOrder.$keyValue/$keyValues" + + private fun toContainKeyValues( + expect: Expect>, + a: Pair.() -> Unit>, + aX: Array.() -> Unit>> + ): Expect> = + mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> + if (others.isEmpty()) expect.toContain.inAnyOrder.entry(first) + else expect.toContain.inAnyOrder.entries(first, *others) + } + + private fun toContainKeyValuesNullable( + expect: Expect>, + a: Pair.() -> Unit)?>, + aX: Array.() -> Unit)?>> + ) = mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> + if (others.isEmpty()) expect.toContain.inAnyOrder.entry(first) + else expect.toContain.inAnyOrder.entries(first, *others) + } + + private fun toContain( + expect: Expect>, + KeyValue: Pair.() -> Unit>, + otherKeyValues: Array.() -> Unit>> + ) = mapArguments(KeyValue, otherKeyValues).to { KeyValue(it.first, it.second) }.let { (first, others) -> + expect.toContain(first, *others) + } + + @JvmName("toContainNullable") + private fun toContain( + expect: Expect>, + KeyValue: Pair.() -> Unit)?>, + otherKeyValues: Array.() -> Unit)?>> + ) = mapArguments(KeyValue, otherKeyValues).to { KeyValue(it.first, it.second) }.let { (first, others) -> + expect.toContain(first, *others) + } + } + + @Suppress("unused", "UNUSED_VALUE") + private fun ambiguityTest() { + var map: Expect> = notImplemented() + var subMap: Expect> = notImplemented() + var nKeyMap: Expect> = notImplemented() + var nValueMap: Expect> = notImplemented() + var nKeyValueMap: Expect> = notImplemented() + var ronKeyValueMap: Expect> = notImplemented() + var starMap: Expect> = notImplemented() + + map = map.toContain.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) + subMap = subMap.toContain.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) + nKeyMap = nKeyMap.toContain.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) + nValueMap = nValueMap.toContain.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) + starMap = starMap.toContain.inAnyOrder.entry(KeyValue(1) { toEqual("a") }) + + map = map.toContain.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) + subMap = subMap.toContain.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) + nKeyMap = nKeyMap.toContain.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) + nValueMap = nValueMap.toContain.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) + starMap = starMap.toContain.inAnyOrder.entries(KeyValue(1) { toEqual("a") }) + + map = map.toContain.inAnyOrder.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + subMap = subMap.toContain.inAnyOrder.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nKeyMap = nKeyMap.toContain.inAnyOrder.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nValueMap = nValueMap.toContain.inAnyOrder.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + starMap = starMap.toContain.inAnyOrder.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + + nKeyMap = nKeyMap.toContain.inAnyOrder.entry(KeyValue(null) { toEqual("a") }) + nKeyMap = nKeyMap.toContain.inAnyOrder.entry(KeyValue(null) { toEqual("a") }) + nValueMap = nValueMap.toContain.inAnyOrder.entry(KeyValue(1.2, null)) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entry(KeyValue(null) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entry(KeyValue(null, null)) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entry(KeyValue(null) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entry(KeyValue(null, null)) + starMap = starMap.toContain.inAnyOrder.entry(KeyValue(null) { toEqual("a") }) + starMap = starMap.toContain.inAnyOrder.entry(KeyValue(null, null)) + + nKeyMap = nKeyMap.toContain.inAnyOrder.entries(KeyValue(null) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entries(KeyValue(null) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entries(KeyValue(null) { toEqual("a") }) + starMap = starMap.toContain.inAnyOrder.entries(KeyValue(null) { toEqual("a") }) + + nKeyMap = nKeyMap.toContain.inAnyOrder.entries(KeyValue(null) { toEqual("a") }) + nValueMap = nValueMap.toContain.inAnyOrder.entries(KeyValue(1, null), KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entries( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entries( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + starMap = starMap.toContain.inAnyOrder.entries( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + + /// ------------- shortcuts ----------------------------------------------------------------- + + map = map.toContain(KeyValue(1) { toEqual("a") }) + subMap = subMap.toContain(KeyValue(1) { toEqual("a") }) + nKeyMap = nKeyMap.toContain(KeyValue(1) { toEqual("a") }) + nValueMap = nValueMap.toContain(KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain(KeyValue(1) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain(KeyValue(1) { toEqual("a") }) + starMap = starMap.toContain(KeyValue(1) { toEqual("a") }) + + map = map.toContain(KeyValue(1) { toEqual("a") }) + subMap = subMap.toContain(KeyValue(1) { toEqual("a") }) + nKeyMap = nKeyMap.toContain(KeyValue(1) { toEqual("a") }) + nValueMap = nValueMap.toContain(KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain(KeyValue(1) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain(KeyValue(1) { toEqual("a") }) + starMap = starMap.toContain(KeyValue(1) { toEqual("a") }) + + map = map.toContain( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + subMap = subMap.toContain( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nKeyMap = nKeyMap.toContain( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nValueMap = nValueMap.toContain( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nKeyValueMap = nKeyValueMap.toContain( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + ronKeyValueMap = ronKeyValueMap.toContain( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + starMap = starMap.toContain( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + + nKeyMap = nKeyMap.toContain(KeyValue(null) { toEqual("a") }) + nValueMap = nValueMap.toContain(KeyValue(1.2, null)) + nKeyValueMap = nKeyValueMap.toContain(KeyValue(null) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain(KeyValue(null, null)) + ronKeyValueMap = ronKeyValueMap.toContain(KeyValue(null) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain(KeyValue(null, null)) + starMap = starMap.toContain(KeyValue(null) { toEqual("a") }) + starMap = starMap.toContain(KeyValue(null, null)) + + nKeyMap = nKeyMap.toContain(KeyValue(null) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain(KeyValue(null) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain(KeyValue(null) { toEqual("a") }) + starMap = starMap.toContain(KeyValue(null) { toEqual("a") }) + + nKeyMap = nKeyMap.toContain(KeyValue(null) { toEqual("a") }) + nValueMap = nValueMap.toContain(KeyValue(1, null), KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + ronKeyValueMap = ronKeyValueMap.toContain( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + starMap = starMap.toContain( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + } +} diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderKeyValuePairsExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderKeyValuePairsExpectationsSpec.kt new file mode 100644 index 000000000..6097e4d33 --- /dev/null +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderKeyValuePairsExpectationsSpec.kt @@ -0,0 +1,152 @@ +package ch.tutteli.atrium.api.fluent.en_GB + +import ch.tutteli.atrium.creating.Expect +import ch.tutteli.atrium.specs.* +import ch.tutteli.atrium.specs.integration.mfun2 +import org.spekframework.spek2.Spek +import ch.tutteli.atrium.api.fluent.en_GB.MapToContainInAnyOrderKeyValuePairsExpectationsSpec.Companion as C + +class MapToContainInAnyOrderKeyValuePairsExpectationsSpec : Spek({ + include(BuilderSpec) + include(ShortcutSpec) +}) { + + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderKeyValuePairsExpectationsSpec( + functionDescription to C::toContainKeyValuePairs, + (functionDescription to C::toContainKeyValuePairsNullable).withNullableSuffix(), + "[Atrium][Builder] " + ) + + object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderKeyValuePairsExpectationsSpec( + mfun2(Expect>::toContain), + mfun2(Expect>::toContain).withNullableSuffix(), + "[Atrium][Shortcut] " + ) + + companion object : MapToContainSpecBase() { + val functionDescription = "$toContain.$inAnyOrder.$keyValuePair/$keyValuePairs" + + private fun toContainKeyValuePairs( + expect: Expect>, + a: Pair, + aX: Array> + ): Expect> = + if (aX.isEmpty()) expect.toContain.inAnyOrder.entry(a) + else expect.toContain.inAnyOrder.entries(a, *aX) + + private fun toContainKeyValuePairsNullable( + expect: Expect>, + a: Pair, + aX: Array> + ): Expect> = + if (aX.isEmpty()) expect.toContain.inAnyOrder.entry(a) + else expect.toContain.inAnyOrder.entries(a, *aX) + } + + @Suppress("unused", "UNUSED_VALUE") + private fun ambiguityTest() { + var map: Expect> = notImplemented() + var subMap: Expect> = notImplemented() + var nKeyMap: Expect> = notImplemented() + var nValueMap: Expect> = notImplemented() + var nKeyValueMap: Expect> = notImplemented() + var ronKeyValueMap: Expect> = notImplemented() + var starMap: Expect> = notImplemented() + + map = map.toContain.inAnyOrder.entry(1 to "a") + subMap = subMap.toContain.inAnyOrder.entry(1 to "a") + nKeyMap = nKeyMap.toContain.inAnyOrder.entry(1 to "a") + nValueMap = nValueMap.toContain.inAnyOrder.entry(1 to "a") + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entry(1 to "a") + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entry(1 to "a") + starMap = starMap.toContain.inAnyOrder.entry(1 to "a") + + map = map.toContain.inAnyOrder.entries(1 to "a") + subMap = subMap.toContain.inAnyOrder.entries(1 to "a") + nKeyMap = nKeyMap.toContain.inAnyOrder.entries(1 to "a") + nValueMap = nValueMap.toContain.inAnyOrder.entries(1 to "a") + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entries(1 to "a") + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entries(1 to "a") + starMap = starMap.toContain.inAnyOrder.entries(1 to "a") + + map = map.toContain.inAnyOrder.entries( + 1 as Number to "a", + 1.2 to "b" + ) + subMap = subMap.toContain.inAnyOrder.entries( + 1 as Number to "a", + 1.2 to "b" + ) + nKeyMap = nKeyMap.toContain.inAnyOrder.entries( + 1 as Number to "a", + 1.2 to "b" + ) + nValueMap = nValueMap.toContain.inAnyOrder.entries( + 1 as Number to "a", + 1.2 to "b" + ) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entries( + 1 as Number to "a", + 1.2 to "b" + ) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entries( + 1 as Number to "a", + 1.2 to "b" + ) + starMap = starMap.toContain.inAnyOrder.entries( + 1 as Number to "a", + 1.2 to "b" + ) + + nKeyMap = nKeyMap.toContain.inAnyOrder.entry(null to "a") + nValueMap = nValueMap.toContain.inAnyOrder.entry(1.2 to null) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entry(null to null) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entry(null to null) + starMap = starMap.toContain.inAnyOrder.entry(null to null) + + nKeyMap = nKeyMap.toContain.inAnyOrder.entries(null to "a", 1 to "b") + nValueMap = nValueMap.toContain.inAnyOrder.entries(1 to null) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.entries((null to "a"), null to null, 1 to null) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.entries((null to "a"), null to null, 1 to null) + starMap = starMap.toContain.inAnyOrder.entries((null to "a"), null to null, 1 to null) + + + /// ------------- shortcuts ----------------------------------------------------------------- + + map = map.toContain(1 to "a") + subMap = subMap.toContain(1 to "a") + nKeyMap = nKeyMap.toContain(1 to "a") + nValueMap = nValueMap.toContain(1 to "a") + nKeyValueMap = nKeyValueMap.toContain(1 to "a") + ronKeyValueMap = ronKeyValueMap.toContain(1 to "a") + starMap = starMap.toContain(1 to "a") + + map = map.toContain(1 to "a") + subMap = subMap.toContain(1 to "a") + nKeyMap = nKeyMap.toContain(1 to "a") + nValueMap = nValueMap.toContain(1 to "a") + nKeyValueMap = nKeyValueMap.toContain(1 to "a") + ronKeyValueMap = ronKeyValueMap.toContain(1 to "a") + starMap = starMap.toContain(1 to "a") + + map = map.toContain(1 as Number to "a", 1.2 to "b") + subMap = subMap.toContain(1 as Number to "a", 1.2 to "b") + nKeyMap = nKeyMap.toContain(1 as Number to "a", 1.2 to "b") + nValueMap = nValueMap.toContain(1 as Number to "a", 1.2 to "b") + nKeyValueMap = nKeyValueMap.toContain(1 as Number to "a", 1.2 to "b") + ronKeyValueMap = ronKeyValueMap.toContain(1 as Number to "a", 1.2 to "b") + starMap = starMap.toContain(1 as Number to "a", 1.2 to "b") + + nKeyMap = nKeyMap.toContain(null to "a") + nValueMap = nValueMap.toContain(1.2 to null) + nKeyValueMap = nKeyValueMap.toContain(null to null) + ronKeyValueMap = ronKeyValueMap.toContain(null to "a") + starMap = starMap.toContain(null to "a") + + nKeyMap = nKeyMap.toContain(null to "a") + nValueMap = nValueMap.toContain(1.2 to null, 1 to null) + nKeyValueMap = nKeyValueMap.toContain(null to "a", null to null, 1 to null) + ronKeyValueMap = ronKeyValueMap.toContain(null to "a", null to null, 1 to null) + starMap = starMap.toContain(null to "a", null to null, 1 to null) + } +} diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderOnlyEntriesOfExpectationsSpec.kt similarity index 51% rename from apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec.kt rename to apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderOnlyEntriesOfExpectationsSpec.kt index 5457912c0..9672cb74f 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderOnlyEntriesOfExpectationsSpec.kt @@ -6,24 +6,24 @@ import ch.tutteli.atrium.specs.* import ch.tutteli.atrium.specs.integration.mfun2 import org.spekframework.spek2.Spek import kotlin.jvm.JvmName -import ch.tutteli.atrium.api.fluent.en_GB.MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec.Companion as C +import ch.tutteli.atrium.api.fluent.en_GB.MapToContainInAnyOrderOnlyEntriesOfExpectationsSpec.Companion as C -class MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec : Spek({ +class MapToContainInAnyOrderOnlyEntriesOfExpectationsSpec : Spek({ include(BuilderSpec) include(ShortcutSpec) include(BuilderMapLikeToIterablePairSpec) include(ShortcutMapLikeToIterablePairSpec) }) { - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( - functionDescription to C::containsKeyValuePairs, - (functionDescription to C::containsKeyValuePairsNullable).withNullableSuffix(), + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec( + functionDescription to C::toContainKeyValuePairs, + (functionDescription to C::toContainKeyValuePairsNullable).withNullableSuffix(), "[Atrium][Builder] " ) - object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( - mfun2(C::containsInAnyOrderOnlyEntriesOf), - mfun2(C::containsInAnyOrderOnlyEntriesOf).withNullableSuffix(), + object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec( + mfun2(C::toContainInAnyOrderOnlyEntriesOf), + mfun2(C::toContainInAnyOrderOnlyEntriesOf).withNullableSuffix(), "[Atrium][Shortcut] " ) @@ -32,20 +32,20 @@ class MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec : Spek({ ch.tutteli.atrium.specs.integration.MapLikeToIterablePairSpec>( functionDescription, mapOf("a" to 1), - { input -> contains.inAnyOrder.only.entriesOf(input) } + { input -> toContain.inAnyOrder.only.entriesOf(input) } ) object ShortcutMapLikeToIterablePairSpec : ch.tutteli.atrium.specs.integration.MapLikeToIterablePairSpec>( - containsOnlyEntriesOf, + toContainOnlyEntriesOf, mapOf("a" to 1), - { input -> containsOnlyEntriesOf(input) } + { input -> toContainOnlyEntriesOf(input) } ) - companion object : MapContainsSpecBase() { - val functionDescription = "$contains.$inAnyOrder.$only.$entriesOf" + companion object : MapToContainSpecBase() { + val functionDescription = "$toContain.$inAnyOrder.$only.$entriesOf" - private fun containsKeyValuePairs( + private fun toContainKeyValuePairs( expect: Expect>, a: Pair, aX: Array> @@ -55,31 +55,31 @@ class MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec : Spek({ } else { mapOf(a, *aX) } - return expect.contains.inAnyOrder.only.entriesOf(mapLike) + return expect.toContain.inAnyOrder.only.entriesOf(mapLike) } - private fun containsKeyValuePairsNullable( + private fun toContainKeyValuePairsNullable( expect: Expect>, a: Pair, aX: Array> ): Expect> = - expect.contains.inAnyOrder.only.entriesOf(listOf(a, *aX)) + expect.toContain.inAnyOrder.only.entriesOf(listOf(a, *aX)) - private fun containsInAnyOrderOnlyEntriesOf( + private fun toContainInAnyOrderOnlyEntriesOf( expect: Expect>, a: Pair, aX: Array> ): Expect> = - expect.containsOnlyEntriesOf(sequenceOf(a, *aX)) + expect.toContainOnlyEntriesOf(sequenceOf(a, *aX)) - @JvmName("containsInAnyOrderOnlyEntriesOfNullable") - private fun containsInAnyOrderOnlyEntriesOf( + @JvmName("toContainInAnyOrderOnlyEntriesOfNullable") + private fun toContainInAnyOrderOnlyEntriesOf( expect: Expect>, a: Pair, aX: Array> ): Expect> = - expect.containsOnlyEntriesOf(arrayOf(a, *aX)) + expect.toContainOnlyEntriesOf(arrayOf(a, *aX)) } @@ -94,20 +94,20 @@ class MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec : Spek({ var ronKeyValueMap: Expect> = notImplemented() var starMap: Expect> = notImplemented() - map = map.contains.inAnyOrder.only.entriesOf(listOf(1 to "a")) - subMap = subMap.contains.inAnyOrder.only.entriesOf(listOf(1 to "a")) - nKeyMap = nKeyMap.contains.inAnyOrder.only.entriesOf(listOf(1 to "a")) - nValueMap = nValueMap.contains.inAnyOrder.only.entriesOf(listOf(1 to "a")) - nKeyValueMap = nKeyValueMap.contains.inAnyOrder.only.entriesOf(listOf(1 to "a")) - ronKeyValueMap = ronKeyValueMap.contains.inAnyOrder.only.entriesOf(listOf(1 to "a")) - starMap = starMap.contains.inAnyOrder.only.entriesOf(listOf(1 to "a")) + map = map.toContain.inAnyOrder.only.entriesOf(listOf(1 to "a")) + subMap = subMap.toContain.inAnyOrder.only.entriesOf(listOf(1 to "a")) + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entriesOf(listOf(1 to "a")) + nValueMap = nValueMap.toContain.inAnyOrder.only.entriesOf(listOf(1 to "a")) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entriesOf(listOf(1 to "a")) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entriesOf(listOf(1 to "a")) + starMap = starMap.toContain.inAnyOrder.only.entriesOf(listOf(1 to "a")) - map = map.containsOnlyEntriesOf(listOf(1 to "a")) - subMap = subMap.containsOnlyEntriesOf(listOf(1 to "a")) - nKeyMap = nKeyMap.containsOnlyEntriesOf(listOf(1 to "a")) - nValueMap = nValueMap.containsOnlyEntriesOf(listOf(1 to "a")) - nKeyValueMap = nKeyValueMap.containsOnlyEntriesOf(listOf(1 to "a")) - ronKeyValueMap = ronKeyValueMap.containsOnlyEntriesOf(listOf(1 to "a")) - starMap = starMap.containsOnlyEntriesOf(listOf(1 to "a")) + map = map.toContainOnlyEntriesOf(listOf(1 to "a")) + subMap = subMap.toContainOnlyEntriesOf(listOf(1 to "a")) + nKeyMap = nKeyMap.toContainOnlyEntriesOf(listOf(1 to "a")) + nValueMap = nValueMap.toContainOnlyEntriesOf(listOf(1 to "a")) + nKeyValueMap = nKeyValueMap.toContainOnlyEntriesOf(listOf(1 to "a")) + ronKeyValueMap = ronKeyValueMap.toContainOnlyEntriesOf(listOf(1 to "a")) + starMap = starMap.toContainOnlyEntriesOf(listOf(1 to "a")) } } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderOnlyKeyValueExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderOnlyKeyValueExpectationsSpec.kt new file mode 100644 index 000000000..e6eecde4c --- /dev/null +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderOnlyKeyValueExpectationsSpec.kt @@ -0,0 +1,238 @@ +package ch.tutteli.atrium.api.fluent.en_GB + +import ch.tutteli.atrium.creating.Expect +import ch.tutteli.atrium.logic.utils.mapArguments +import ch.tutteli.atrium.specs.* +import ch.tutteli.atrium.specs.integration.mfun2 +import org.spekframework.spek2.Spek +import kotlin.jvm.JvmName +import ch.tutteli.atrium.api.fluent.en_GB.MapToContainInAnyOrderOnlyKeyValueExpectationsSpec.Companion as C + +class MapToContainInAnyOrderOnlyKeyValueExpectationsSpec : Spek({ + include(BuilderSpec) + include(ShortcutSpec) +}) { + + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderOnlyKeyValueExpectationsSpec( + functionDescription to C::toContainKeyValues, + (functionDescription to C::toContainKeyValuesNullable).withNullableSuffix(), + "[Atrium][Builder] " + ) + + + object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderOnlyKeyValueExpectationsSpec( + mfun2.() -> Unit>(C::toContainOnly), + mfun2.() -> Unit)?>(C::toContainOnly).withNullableSuffix(), + "[Atrium][Shortcut] " + ) + + companion object : MapToContainSpecBase() { + val functionDescription = "$toContain.$inAnyOrder.$only.$keyValue/$keyValues" + + private fun toContainKeyValues( + expect: Expect>, + a: Pair.() -> Unit>, + aX: Array.() -> Unit>> + ) = mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> + if (others.isEmpty()) expect.toContain.inAnyOrder.only.entry(first) + else expect.toContain.inAnyOrder.only.entries(first, *others) + } + + private fun toContainKeyValuesNullable( + expect: Expect>, + a: Pair.() -> Unit)?>, + aX: Array.() -> Unit)?>> + ) = mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> + if (others.isEmpty()) expect.toContain.inAnyOrder.only.entry(first) + else expect.toContain.inAnyOrder.only.entries(first, *others) + } + + private fun toContainOnly( + expect: Expect>, + a: Pair.() -> Unit>, + aX: Array.() -> Unit>> + ): Expect> = + mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> + expect.toContainOnly(first, *others) + } + + @JvmName("toContainInAnyOrderOnlyNullable") + private fun toContainOnly( + expect: Expect>, + a: Pair.() -> Unit)?>, + aX: Array.() -> Unit)?>> + ): Expect> = + mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> + expect.toContainOnly(first, *others) + } + } + + + @Suppress("unused", "UNUSED_VALUE") + private fun ambiguityTest() { + var map: Expect> = notImplemented() + var subMap: Expect> = notImplemented() + var nKeyMap: Expect> = notImplemented() + var nValueMap: Expect> = notImplemented() + var nKeyValueMap: Expect> = notImplemented() + var ronKeyValueMap: Expect> = notImplemented() + var starMap: Expect> = notImplemented() + + map = map.toContain.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) + subMap = subMap.toContain.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) + nValueMap = nValueMap.toContain.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) + starMap = starMap.toContain.inAnyOrder.only.entry(KeyValue(1) { toEqual("a") }) + + map = map.toContain.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) + subMap = subMap.toContain.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) + nValueMap = nValueMap.toContain.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) + starMap = starMap.toContain.inAnyOrder.only.entries(KeyValue(1) { toEqual("a") }) + + map = map.toContain.inAnyOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + subMap = subMap.toContain.inAnyOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nValueMap = nValueMap.toContain.inAnyOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + starMap = starMap.toContain.inAnyOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entry(KeyValue(null) { toEqual("a") }) + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entry(KeyValue(null) { toEqual("a") }) + nValueMap = nValueMap.toContain.inAnyOrder.only.entry(KeyValue(1.2, null)) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entry(KeyValue(null) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entry(KeyValue(null, null)) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entry(KeyValue(null) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entry(KeyValue(null, null)) + starMap = starMap.toContain.inAnyOrder.only.entry(KeyValue(null) { toEqual("a") }) + starMap = starMap.toContain.inAnyOrder.only.entry(KeyValue(null, null)) + + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entries(KeyValue(null) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entries(KeyValue(null) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entries(KeyValue(null) { toEqual("a") }) + starMap = starMap.toContain.inAnyOrder.only.entries(KeyValue(null) { toEqual("a") }) + + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entries(KeyValue(null) { toEqual("a") }) + nValueMap = nValueMap.toContain.inAnyOrder.only.entries(KeyValue(1, null), KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entries( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entries( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + starMap = starMap.toContain.inAnyOrder.only.entries( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + + /// ------------- shortcuts ----------------------------------------------------------------- + + map = map.toContainOnly(KeyValue(1) { toEqual("a") }) + subMap = subMap.toContainOnly(KeyValue(1) { toEqual("a") }) + nKeyMap = nKeyMap.toContainOnly(KeyValue(1) { toEqual("a") }) + nValueMap = nValueMap.toContainOnly(KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContainOnly(KeyValue(1) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContainOnly(KeyValue(1) { toEqual("a") }) + starMap = starMap.toContainOnly(KeyValue(1) { toEqual("a") }) + + map = map.toContainOnly(KeyValue(1) { toEqual("a") }) + subMap = subMap.toContainOnly(KeyValue(1) { toEqual("a") }) + nKeyMap = nKeyMap.toContainOnly(KeyValue(1) { toEqual("a") }) + nValueMap = nValueMap.toContainOnly(KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContainOnly(KeyValue(1) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContainOnly(KeyValue(1) { toEqual("a") }) + starMap = starMap.toContainOnly(KeyValue(1) { toEqual("a") }) + + map = map.toContainOnly( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + subMap = subMap.toContainOnly( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nKeyMap = nKeyMap.toContainOnly( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nValueMap = nValueMap.toContainOnly( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nKeyValueMap = nKeyValueMap.toContainOnly( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + ronKeyValueMap = ronKeyValueMap.toContainOnly( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + starMap = starMap.toContainOnly( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + + nKeyMap = nKeyMap.toContainOnly(KeyValue(null) { toEqual("a") }) + nValueMap = nValueMap.toContainOnly(KeyValue(1.2, null)) + nKeyValueMap = nKeyValueMap.toContainOnly(KeyValue(null) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContainOnly(KeyValue(null, null)) + ronKeyValueMap = ronKeyValueMap.toContainOnly(KeyValue(null) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContainOnly(KeyValue(null, null)) + starMap = starMap.toContainOnly(KeyValue(null) { toEqual("a") }) + starMap = starMap.toContainOnly(KeyValue(null, null)) + + nKeyMap = nKeyMap.toContainOnly(KeyValue(null) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContainOnly(KeyValue(null) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContainOnly(KeyValue(null) { toEqual("a") }) + starMap = starMap.toContainOnly(KeyValue(null) { toEqual("a") }) + + nKeyMap = nKeyMap.toContainOnly(KeyValue(null) { toEqual("a") }) + nValueMap = nValueMap.toContainOnly(KeyValue(1, null), KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContainOnly( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + ronKeyValueMap = ronKeyValueMap.toContainOnly( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + starMap = starMap.toContainOnly( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + } +} diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt new file mode 100644 index 000000000..725b60abf --- /dev/null +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt @@ -0,0 +1,153 @@ +package ch.tutteli.atrium.api.fluent.en_GB + +import ch.tutteli.atrium.creating.Expect +import ch.tutteli.atrium.specs.* +import ch.tutteli.atrium.specs.integration.mfun2 +import org.spekframework.spek2.Spek +import ch.tutteli.atrium.api.fluent.en_GB.MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec.Companion as C + +class MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec : Spek({ + include(BuilderSpec) + include(ShortcutSpec) +}) { + + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec( + functionDescription to C::toContainKeyValuePairs, + (functionDescription to C::toContainKeyValuePairsNullable).withNullableSuffix(), + "[Atrium][Builder] " + ) + + object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec( + mfun2(Expect>::toContainOnly), + mfun2(Expect>::toContainOnly).withNullableSuffix(), + "[Atrium][Shortcut] " + ) + + companion object : MapToContainSpecBase() { + val functionDescription = "$toContain.$inAnyOrder.$only.$keyValuePair/$keyValuePairs" + + private fun toContainKeyValuePairs( + expect: Expect>, + a: Pair, + aX: Array> + ): Expect> = + if (aX.isEmpty()) expect.toContain.inAnyOrder.only.entry(a) + else expect.toContain.inAnyOrder.only.entries(a, *aX) + + private fun toContainKeyValuePairsNullable( + expect: Expect>, + a: Pair, + aX: Array> + ): Expect> = + if (aX.isEmpty()) expect.toContain.inAnyOrder.only.entry(a) + else expect.toContain.inAnyOrder.only.entries(a, *aX) + } + + + @Suppress("unused", "UNUSED_VALUE") + private fun ambiguityTest() { + var map: Expect> = notImplemented() + var subMap: Expect> = notImplemented() + var nKeyMap: Expect> = notImplemented() + var nValueMap: Expect> = notImplemented() + var nKeyValueMap: Expect> = notImplemented() + var ronKeyValueMap: Expect> = notImplemented() + var starMap: Expect> = notImplemented() + + map = map.toContain.inAnyOrder.only.entry(1 to "a") + subMap = subMap.toContain.inAnyOrder.only.entry(1 to "a") + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entry(1 to "a") + nValueMap = nValueMap.toContain.inAnyOrder.only.entry(1 to "a") + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entry(1 to "a") + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entry(1 to "a") + starMap = starMap.toContain.inAnyOrder.only.entry(1 to "a") + + map = map.toContain.inAnyOrder.only.entries(1 to "a") + subMap = subMap.toContain.inAnyOrder.only.entries(1 to "a") + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entries(1 to "a") + nValueMap = nValueMap.toContain.inAnyOrder.only.entries(1 to "a") + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entries(1 to "a") + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entries(1 to "a") + starMap = starMap.toContain.inAnyOrder.only.entries(1 to "a") + + map = map.toContain.inAnyOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + subMap = subMap.toContain.inAnyOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + nValueMap = nValueMap.toContain.inAnyOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + starMap = starMap.toContain.inAnyOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entry(null to "a") + nValueMap = nValueMap.toContain.inAnyOrder.only.entry(1.2 to null) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entry(null to null) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entry(null to null) + starMap = starMap.toContain.inAnyOrder.only.entry(null to null) + + nKeyMap = nKeyMap.toContain.inAnyOrder.only.entries(null to "a", 1 to "b") + nValueMap = nValueMap.toContain.inAnyOrder.only.entries(1 to null) + nKeyValueMap = nKeyValueMap.toContain.inAnyOrder.only.entries((null to "a"), null to null, 1 to null) + ronKeyValueMap = ronKeyValueMap.toContain.inAnyOrder.only.entries((null to "a"), null to null, 1 to null) + starMap = starMap.toContain.inAnyOrder.only.entries((null to "a"), null to null, 1 to null) + + + /// ------------- shortcuts ----------------------------------------------------------------- + + map = map.toContainOnly(1 to "a") + subMap = subMap.toContainOnly(1 to "a") + nKeyMap = nKeyMap.toContainOnly(1 to "a") + nValueMap = nValueMap.toContainOnly(1 to "a") + nKeyValueMap = nKeyValueMap.toContainOnly(1 to "a") + ronKeyValueMap = ronKeyValueMap.toContainOnly(1 to "a") + starMap = starMap.toContainOnly(1 to "a") + + map = map.toContainOnly(1 to "a") + subMap = subMap.toContainOnly(1 to "a") + nKeyMap = nKeyMap.toContainOnly(1 to "a") + nValueMap = nValueMap.toContainOnly(1 to "a") + nKeyValueMap = nKeyValueMap.toContainOnly(1 to "a") + ronKeyValueMap = ronKeyValueMap.toContainOnly(1 to "a") + starMap = starMap.toContainOnly(1 to "a") + + map = map.toContainOnly(1 as Number to "a", 1.2 to "b") + subMap = subMap.toContainOnly(1 as Number to "a", 1.2 to "b") + nKeyMap = nKeyMap.toContainOnly(1 as Number to "a", 1.2 to "b") + nValueMap = nValueMap.toContainOnly(1 as Number to "a", 1.2 to "b") + nKeyValueMap = nKeyValueMap.toContainOnly(1 as Number to "a", 1.2 to "b") + ronKeyValueMap = ronKeyValueMap.toContainOnly(1 as Number to "a", 1.2 to "b") + starMap = starMap.toContainOnly(1 as Number to "a", 1.2 to "b") + + nKeyMap = nKeyMap.toContainOnly(null to "a") + nValueMap = nValueMap.toContainOnly(1.2 to null) + nKeyValueMap = nKeyValueMap.toContainOnly(null to null) + ronKeyValueMap = ronKeyValueMap.toContainOnly(null to "a") + starMap = starMap.toContainOnly(null to "a") + + nKeyMap = nKeyMap.toContainOnly(null to "a") + nValueMap = nValueMap.toContainOnly(1.2 to null, 1 to null) + nKeyValueMap = nKeyValueMap.toContainOnly(null to "a", null to null, 1 to null) + ronKeyValueMap = ronKeyValueMap.toContainOnly(null to "a", null to null, 1 to null) + starMap = starMap.toContainOnly(null to "a", null to null, 1 to null) + } +} diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInOrderOnlyEntriesOfExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInOrderOnlyEntriesOfExpectationsSpec.kt similarity index 57% rename from apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInOrderOnlyEntriesOfExpectationsSpec.kt rename to apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInOrderOnlyEntriesOfExpectationsSpec.kt index cfda492da..95a125d24 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsInOrderOnlyEntriesOfExpectationsSpec.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInOrderOnlyEntriesOfExpectationsSpec.kt @@ -5,15 +5,15 @@ import ch.tutteli.atrium.logic.creating.typeutils.MapLike import ch.tutteli.atrium.specs.notImplemented import ch.tutteli.atrium.specs.withNullableSuffix import org.spekframework.spek2.Spek -import ch.tutteli.atrium.api.fluent.en_GB.MapContainsInOrderOnlyEntriesOfExpectationsSpec.Companion as C +import ch.tutteli.atrium.api.fluent.en_GB.MapToContainInOrderOnlyEntriesOfExpectationsSpec.Companion as C -class MapContainsInOrderOnlyEntriesOfExpectationsSpec : Spek({ +class MapToContainInOrderOnlyEntriesOfExpectationsSpec : Spek({ include(BuilderSpec) }) { - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInOrderOnlyKeyValuePairsExpectationsSpec( - functionDescription to C::containsKeyValuePairs, - (functionDescription to C::containsKeyValuePairsNullable).withNullableSuffix(), + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInOrderOnlyKeyValuePairsExpectationsSpec( + functionDescription to C::toContainKeyValuePairs, + (functionDescription to C::toContainKeyValuePairsNullable).withNullableSuffix(), "[Atrium][Builder] " ) @@ -21,13 +21,13 @@ class MapContainsInOrderOnlyEntriesOfExpectationsSpec : Spek({ ch.tutteli.atrium.specs.integration.MapLikeToIterablePairSpec>( functionDescription, mapOf("a" to 1), - { input -> contains.inOrder.only.entriesOf(input) } + { input -> toContain.inOrder.only.entriesOf(input) } ) - companion object : MapContainsSpecBase() { - val functionDescription = "$contains.$inOrder.$only.$entriesOf" + companion object : MapToContainSpecBase() { + val functionDescription = "$toContain.$inOrder.$only.$entriesOf" - private fun containsKeyValuePairs( + private fun toContainKeyValuePairs( expect: Expect>, a: Pair, aX: Array> @@ -37,15 +37,15 @@ class MapContainsInOrderOnlyEntriesOfExpectationsSpec : Spek({ } else { mapOf(a, *aX) } - return expect.contains.inOrder.only.entriesOf(mapLike) + return expect.toContain.inOrder.only.entriesOf(mapLike) } - private fun containsKeyValuePairsNullable( + private fun toContainKeyValuePairsNullable( expect: Expect>, a: Pair, aX: Array> ): Expect> = - expect.contains.inOrder.only.entriesOf(arrayOf(a, *aX)) + expect.toContain.inOrder.only.entriesOf(arrayOf(a, *aX)) } @@ -60,12 +60,12 @@ class MapContainsInOrderOnlyEntriesOfExpectationsSpec : Spek({ var ronKeyValueMap: Expect> = notImplemented() var starMap: Expect> = notImplemented() - map = map.contains.inOrder.only.entriesOf(listOf(1 to "a")) - subMap = subMap.contains.inOrder.only.entriesOf(listOf(1 to "a")) - nKeyMap = nKeyMap.contains.inOrder.only.entriesOf(listOf(1 to "a")) - nValueMap = nValueMap.contains.inOrder.only.entriesOf(listOf(1 to "a")) - nKeyValueMap = nKeyValueMap.contains.inOrder.only.entriesOf(listOf(1 to "a")) - ronKeyValueMap = ronKeyValueMap.contains.inOrder.only.entriesOf(listOf(1 to "a")) - starMap = starMap.contains.inOrder.only.entriesOf(listOf(1 to "a")) + map = map.toContain.inOrder.only.entriesOf(listOf(1 to "a")) + subMap = subMap.toContain.inOrder.only.entriesOf(listOf(1 to "a")) + nKeyMap = nKeyMap.toContain.inOrder.only.entriesOf(listOf(1 to "a")) + nValueMap = nValueMap.toContain.inOrder.only.entriesOf(listOf(1 to "a")) + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entriesOf(listOf(1 to "a")) + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entriesOf(listOf(1 to "a")) + starMap = starMap.toContain.inOrder.only.entriesOf(listOf(1 to "a")) } } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInOrderOnlyKeyValueExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInOrderOnlyKeyValueExpectationsSpec.kt new file mode 100644 index 000000000..e777fe503 --- /dev/null +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInOrderOnlyKeyValueExpectationsSpec.kt @@ -0,0 +1,130 @@ +package ch.tutteli.atrium.api.fluent.en_GB + +import ch.tutteli.atrium.creating.Expect +import ch.tutteli.atrium.logic.utils.mapArguments +import ch.tutteli.atrium.specs.notImplemented +import ch.tutteli.atrium.specs.withNullableSuffix +import org.spekframework.spek2.Spek +import ch.tutteli.atrium.api.fluent.en_GB.MapToContainInOrderOnlyKeyValueExpectationsSpec.Companion as C + +class MapToContainInOrderOnlyKeyValueExpectationsSpec : Spek({ + include(BuilderSpec) +}) { + + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInOrderOnlyKeyValueExpectationsSpec( + functionDescription to C::toContainKeyValues, + (functionDescription to C::toContainKeyValuesNullable).withNullableSuffix(), + "[Atrium][Builder] " + ) + + companion object : MapToContainSpecBase() { + val functionDescription = "$toContain.$inOrder.$only.$keyValue/$keyValues" + + private fun toContainKeyValues( + expect: Expect>, + a: Pair.() -> Unit>, + aX: Array.() -> Unit>> + ) = mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> + if (others.isEmpty()) expect.toContain.inOrder.only.entry(first) + else expect.toContain.inOrder.only.entries(first, *others) + } + + private fun toContainKeyValuesNullable( + expect: Expect>, + a: Pair.() -> Unit)?>, + aX: Array.() -> Unit)?>> + ) = mapArguments(a, aX).to { KeyValue(it.first, it.second) }.let { (first, others) -> + if (others.isEmpty()) expect.toContain.inOrder.only.entry(first) + else expect.toContain.inOrder.only.entries(first, *others) + } + } + + @Suppress("unused", "UNUSED_VALUE") + private fun ambiguityTest() { + var map: Expect> = notImplemented() + var subMap: Expect> = notImplemented() + var nKeyMap: Expect> = notImplemented() + var nValueMap: Expect> = notImplemented() + var nKeyValueMap: Expect> = notImplemented() + var ronKeyValueMap: Expect> = notImplemented() + var starMap: Expect> = notImplemented() + + map = map.toContain.inOrder.only.entry(KeyValue(1) { toEqual("a") }) + subMap = subMap.toContain.inOrder.only.entry(KeyValue(1) { toEqual("a") }) + nKeyMap = nKeyMap.toContain.inOrder.only.entry(KeyValue(1) { toEqual("a") }) + nValueMap = nValueMap.toContain.inOrder.only.entry(KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entry(KeyValue(1) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entry(KeyValue(1) { toEqual("a") }) + starMap = starMap.toContain.inOrder.only.entry(KeyValue(1) { toEqual("a") }) + + map = map.toContain.inOrder.only.entries(KeyValue(1) { toEqual("a") }) + subMap = subMap.toContain.inOrder.only.entries(KeyValue(1) { toEqual("a") }) + nKeyMap = nKeyMap.toContain.inOrder.only.entries(KeyValue(1) { toEqual("a") }) + nValueMap = nValueMap.toContain.inOrder.only.entries(KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entries(KeyValue(1) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entries(KeyValue(1) { toEqual("a") }) + starMap = starMap.toContain.inOrder.only.entries(KeyValue(1) { toEqual("a") }) + + map = map.toContain.inOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + subMap = subMap.toContain.inOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nKeyMap = nKeyMap.toContain.inOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nValueMap = nValueMap.toContain.inOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + starMap = starMap.toContain.inOrder.only.entries( + KeyValue(1 as Number) { toEqual("a") }, + KeyValue(1.2) { toEqual("b") } + ) + + nKeyMap = nKeyMap.toContain.inOrder.only.entry(KeyValue(null) { toEqual("a") }) + nKeyMap = nKeyMap.toContain.inOrder.only.entry(KeyValue(null) { toEqual("a") }) + nValueMap = nValueMap.toContain.inOrder.only.entry(KeyValue(1.2, null)) + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entry(KeyValue(null) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entry(KeyValue(null, null)) + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entry(KeyValue(null) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entry(KeyValue(null, null)) + starMap = starMap.toContain.inOrder.only.entry(KeyValue(null) { toEqual("a") }) + starMap = starMap.toContain.inOrder.only.entry(KeyValue(null, null)) + + nKeyMap = nKeyMap.toContain.inOrder.only.entries(KeyValue(null) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entries(KeyValue(null) { toEqual("a") }) + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entries(KeyValue(null) { toEqual("a") }) + starMap = starMap.toContain.inOrder.only.entries(KeyValue(null) { toEqual("a") }) + + nKeyMap = nKeyMap.toContain.inOrder.only.entries(KeyValue(null) { toEqual("a") }) + nValueMap = nValueMap.toContain.inOrder.only.entries(KeyValue(1, null), KeyValue(1) { toEqual("a") }) + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entries( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entries( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + starMap = starMap.toContain.inOrder.only.entries( + KeyValue(null) { toEqual("a") }, + KeyValue(null, null), + KeyValue(1, null) + ) + } +} diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInOrderOnlyKeyValuePairsExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInOrderOnlyKeyValuePairsExpectationsSpec.kt new file mode 100644 index 000000000..8246f1b21 --- /dev/null +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainInOrderOnlyKeyValuePairsExpectationsSpec.kt @@ -0,0 +1,107 @@ +package ch.tutteli.atrium.api.fluent.en_GB + +import ch.tutteli.atrium.creating.Expect +import ch.tutteli.atrium.specs.notImplemented +import ch.tutteli.atrium.specs.withNullableSuffix +import org.spekframework.spek2.Spek +import ch.tutteli.atrium.api.fluent.en_GB.MapToContainInOrderOnlyKeyValuePairsExpectationsSpec.Companion as C + +class MapToContainInOrderOnlyKeyValuePairsExpectationsSpec : Spek({ + include(BuilderSpec) +}) { + + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInOrderOnlyKeyValuePairsExpectationsSpec( + functionDescription to C::toContainKeyValuePairs, + (functionDescription to C::toContainKeyValuePairsNullable).withNullableSuffix(), + "[Atrium][Builder] " + ) + + companion object : MapToContainSpecBase() { + val functionDescription = "$toContain.$inOrder.$only.$keyValuePair/$keyValuePairs" + + private fun toContainKeyValuePairs( + expect: Expect>, + a: Pair, + aX: Array> + ): Expect> = + if (aX.isEmpty()) expect.toContain.inOrder.only.entry(a) + else expect.toContain.inOrder.only.entries(a, *aX) + + private fun toContainKeyValuePairsNullable( + expect: Expect>, + a: Pair, + aX: Array> + ): Expect> = + if (aX.isEmpty()) expect.toContain.inOrder.only.entry(a) + else expect.toContain.inOrder.only.entries(a, *aX) + } + + + @Suppress("unused", "UNUSED_VALUE") + private fun ambiguityTest() { + var map: Expect> = notImplemented() + var subMap: Expect> = notImplemented() + var nKeyMap: Expect> = notImplemented() + var nValueMap: Expect> = notImplemented() + var nKeyValueMap: Expect> = notImplemented() + var ronKeyValueMap: Expect> = notImplemented() + var starMap: Expect> = notImplemented() + + map = map.toContain.inOrder.only.entry(1 to "a") + subMap = subMap.toContain.inOrder.only.entry(1 to "a") + nKeyMap = nKeyMap.toContain.inOrder.only.entry(1 to "a") + nValueMap = nValueMap.toContain.inOrder.only.entry(1 to "a") + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entry(1 to "a") + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entry(1 to "a") + starMap = starMap.toContain.inOrder.only.entry(1 to "a") + + map = map.toContain.inOrder.only.entries(1 to "a") + subMap = subMap.toContain.inOrder.only.entries(1 to "a") + nKeyMap = nKeyMap.toContain.inOrder.only.entries(1 to "a") + nValueMap = nValueMap.toContain.inOrder.only.entries(1 to "a") + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entries(1 to "a") + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entries(1 to "a") + starMap = starMap.toContain.inOrder.only.entries(1 to "a") + + map = map.toContain.inOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + subMap = subMap.toContain.inOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + nKeyMap = nKeyMap.toContain.inOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + nValueMap = nValueMap.toContain.inOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + starMap = starMap.toContain.inOrder.only.entries( + 1 as Number to "a", + 1.2 to "b" + ) + + nKeyMap = nKeyMap.toContain.inOrder.only.entry(null to "a") + nValueMap = nValueMap.toContain.inOrder.only.entry(1.2 to null) + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entry(null to null) + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entry(null to null) + starMap = starMap.toContain.inOrder.only.entry(null to null) + + nKeyMap = nKeyMap.toContain.inOrder.only.entries(null to "a", 1 to "b") + nValueMap = nValueMap.toContain.inOrder.only.entries(1 to null) + nKeyValueMap = nKeyValueMap.toContain.inOrder.only.entries((null to "a"), null to null, 1 to null) + ronKeyValueMap = ronKeyValueMap.toContain.inOrder.only.entries((null to "a"), null to null, 1 to null) + starMap = starMap.toContain.inOrder.only.entries((null to "a"), null to null, 1 to null) + } +} diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsSpecBase.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainSpecBase.kt similarity index 87% rename from apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsSpecBase.kt rename to apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainSpecBase.kt index 1dc3b7c27..d02dc2af7 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapContainsSpecBase.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/MapToContainSpecBase.kt @@ -7,11 +7,11 @@ import kotlin.reflect.KProperty import kotlin.reflect.KFunction2 import kotlin.reflect.KFunction3 -abstract class MapContainsSpecBase { - private val containsProp: KProperty<*> = Expect>::contains - protected val contains = containsProp.name - protected val containsEntriesOf = Expect>::containsEntriesOf.name - protected val containsOnlyEntriesOf = Expect>::containsOnlyEntriesOf.name +abstract class MapToContainSpecBase { + private val toContainProp: KProperty<*> = Expect>::toContain + protected val toContain = toContainProp.name + protected val toContainEntriesOf = Expect>::toContainEntriesOf.name + protected val toContainOnlyEntriesOf = Expect>::toContainOnlyEntriesOf.name //@formatter:off protected val inAnyOrder = MapLikeContains.EntryPointStep, NoOpSearchBehaviour>::inAnyOrder.name diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ListExpectationSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ListExpectationSamples.kt index baabbe946..1bee7a253 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ListExpectationSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ListExpectationSamples.kt @@ -59,7 +59,7 @@ class ListExpectationSamples { .get(0) { toBeGreaterThan(2) // fails toBeLessThan(0) // still evaluated even though `isGreaterThan(2)` already fails, - // use the `.get(index).` if you want a fail fast behaviour + // use `.get(index).` if you want a fail fast behaviour } }.messageContains( "is greater than: 2", diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapExpectationSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapExpectationSamples.kt new file mode 100644 index 000000000..3a19bb023 --- /dev/null +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapExpectationSamples.kt @@ -0,0 +1,255 @@ +package ch.tutteli.atrium.api.fluent.en_GB.samples + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.internal.expect +import kotlin.test.Test + +class MapExpectationSamples { + + @Test + fun toContainBuilder() { + expect(mapOf(1 to "a")).toContain.inAnyOrder.entries(1 to "a") + + fails { // because the map does not contain key 1 with value "b" + expect(mapOf(1 to "a")).toContain.inAnyOrder.entries(1 to "b") + } + } + + @Test + fun toContainPair() { + expect(mapOf(1 to "a")).toContain(1 to "a") + + fails { // because the map does not contain key 1 with value "b" + expect(mapOf(1 to "a")).toContain(1 to "b") + } + } + + @Test + fun toContainOnlyPair() { + expect(mapOf(1 to "a")).toContainOnly(1 to "a") + + fails { // because the map contains key 2 with value "b" in addition + expect(mapOf(1 to "a", 2 to "b")).toContainOnly(1 to "a") + } + } + + @Test + fun toContainKeyValue() { + expect(mapOf(1 to "a")) + .toContain(KeyValue(1) { // subject inside this block is of type String (actually "a") + toEqual("a") + }) + + fails { + expect(mapOf(1 to "a")) + .toContain(KeyValue(1) { // subject inside this block is of type String (actually "a") + toEqual("b") // fails because "a" is not equal to "b" + }) + } + } + + @Test + fun toContainOnlyKeyValue() { + expect(mapOf(1 to "a")) + .toContainOnly(KeyValue(1) { // subject inside this block is of type String (actually "a") + toEqual("a") + }) + + fails { + expect(mapOf(1 to "a", 2 to "b")) + .toContainOnly(KeyValue(1) { // subject inside this block is of type String (actually "a") + toEqual("a") + }) // fails because the map contains key 2 with value "b" in addition + } + } + + @Test + fun toContainEntriesOf() { + expect(mapOf(1 to "a")).toContainEntriesOf(mapOf(1 to "a")) + + fails { // because the map does not contain entry with key 1 and value "b" + expect(mapOf(1 to "a")).toContainEntriesOf(mapOf(1 to "b")) + } + } + + @Test + fun toContainOnlyEntriesOf() { + expect(mapOf(1 to "a")).toContainOnlyEntriesOf(mapOf(1 to "a")) + + fails { // because the map contains key 2 with value "b" in addition + expect(mapOf(1 to "a", 2 to "b")) + .toContainOnlyEntriesOf(mapOf(1 to "a")) + } + } + + @Test + fun toContainKey() { + expect(mapOf(1 to "a")).toContainKey(1) + + fails { // because the map does not contain a key that equals 2 + expect(mapOf(1 to "a")).toContainKey(2) + } + } + + @Test + fun notToContainKey() { + expect(mapOf(1 to "a")).notToContainKey(2) + + fails { // because the map contains a key which equals 1 + expect(mapOf(1 to "a")).notToContainKey(1) + } + } + + @Test + fun getExistingFeature() { + expect(mapOf(1 to "a")) + .getExisting(1) // subject is of type String (actually "a") + .toEqual("a") + + fails { + expect(mapOf(1 to "a")) + .getExisting(1) // subject is of type String (actually "a") + .toEqual("b") // fails because "a" is not equal to "b" + } + + fails { + expect(mapOf(1 to "a")) + .getExisting(2) // expectation fails because key 2 does not exist + .toEqual("a") // not reported, use `getExisting(key) { ... }` + // if you want that all expectations are evaluated + } + } + + @Test + fun getExisting() { + expect(mapOf(1 to "a")) + .getExisting(1) { // subject inside this block is of type String (actually "a") + toEqual("a") + } + + fails { + expect(mapOf(1 to "a")) + .getExisting(1) { // subject inside this block is of type String (actually "a") + toEqual("b") // fails because "a" is not equal to "b" + } + } + + fails { + // all expectations are evaluated inside an expectation group block; for more details: + // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + + expect(mapOf(1 to "a")) + .getExisting(2) { // fails because key 2 does not exist + toEqual("a") // still evaluated because we use an expectation group block + // use `.getExisting(key).` if you want a fail fast behaviour + } + } + } + + @Test + fun keysFeature() { + expect(mapOf(1 to "a")) + .keys // subject is now of type Set (containing 1) + .toContain(1) + + fails { + expect(mapOf(1 to "a")) + .keys // subject is now of type Set (containing 1) + .toContain(2) // fails because 1 is not equal to 2 + } + } + + @Test + fun keys() { + expect(mapOf(1 to "a")) + .keys { // subject inside this block is of type Set (containing 1) + toEqual(setOf(1)) + } + + fails { + // all expectations are evaluated inside an expectation group block; for more details: + // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + + expect(mapOf(1 to "a")) + .keys { // subject inside this block is of type Set (containing 1) + toEqual(setOf(2)) // fails because 1 is not equal to 2 + toHaveSize(3) // still evaluated because we use an expectation group block + // use `.keys.` if you want a fail fast behaviour + } + } + } + + @Test + fun valuesFeature() { + expect(mapOf(1 to "a")) + .values // subject is now of type Collection (containing "a") + .toContain("a") + + fails { + expect(mapOf(1 to "a")) + .values // subject is now of type Collection (containing "a") + .toContain("b") // fails because "a" is not equal to "b" + } + } + + @Test + fun values() { + expect(mapOf(1 to "a")) + .values { // subject inside this block is of type Collection (containing "a") + toEqual(setOf("a")) + } + + fails { + // all expectations are evaluated inside an expectation group block; for more details: + // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + + expect(mapOf(1 to "a")) + .values { // subject inside this block is of type Collection (containing <"a">) + toEqual(setOf("b")) // fails because "a" is not equal to "b" + // use `.values.` if you want a fail fast behaviour + } + } + } + + @Test + fun asEntriesFeature() { + expect(mapOf(1 to "a")).asEntries() + .toEqual(mapOf(1 to "a").entries) + + fails { // because <1,"a"> is not equal to <1,"b"> + expect(mapOf(1 to "a")).asEntries() + .toEqual(mapOf(1 to "b").entries) + } + } + + @Test + fun asEntries() { + expect(mapOf(1 to "a")).asEntries { // subject inside this block is of type Map.Entry (actually <1,"a">) + toEqual(mapOf(1 to "a").entries) + } + + fails { + expect(mapOf(1 to "a")).asEntries { // subject inside this block is of type Map.Entry (actually <1,"a">) + toEqual(mapOf(1 to "b").entries) // fails because <1,"a"> is not equal to <1,"b"> + } + } + } + + @Test + fun toBeEmpty() { + expect(emptyMap()).isEmpty() + + fails { // because the map is not empty + expect(mapOf(1 to "a")).isEmpty() + } + } + + @Test + fun notToBeEmpty() { + expect(mapOf(1 to "a")).isNotEmpty() + + fails { // because the map is empty + expect(emptyMap()).isNotEmpty() + } + } +} diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderEntriesOfExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderEntriesOfExpectationsSpec.kt index 40dc2e007..e86d46c04 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderEntriesOfExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderEntriesOfExpectationsSpec.kt @@ -14,13 +14,13 @@ class MapContainsInAnyOrderEntriesOfExpectationsSpec : Spek({ include(BuilderMapLikeToIterablePairSpec) include(ShortcutMapLikeToIterablePairSpec) }) { - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderKeyValuePairsExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderKeyValuePairsExpectationsSpec( containsKeyValuePair_s to C::containsKeyValuePairs, (containsKeyValuePair_s to C::containsKeyValuePairsNullable).withNullableSuffix(), "[Atrium][Shortcut] " ) - object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderKeyValuePairsExpectationsSpec( + object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderKeyValuePairsExpectationsSpec( mfun2(C::containsEntriesOf), mfun2(C::containsEntriesOf).withNullableSuffix(), "[Atrium][Shortcut] " diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderKeyValueExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderKeyValueExpectationsSpec.kt index 6834a2f92..ee3f38b0d 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderKeyValueExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderKeyValueExpectationsSpec.kt @@ -12,13 +12,13 @@ class MapContainsInAnyOrderKeyValueExpectationsSpec : Spek({ include(BuilderSpec) include(ShortcutSpec) }) { - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderKeyValueExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderKeyValueExpectationsSpec( containsKeyValue_s to C::containsKeyValues, (containsKeyValue_s to C::containsKeyValuesNullable).withNullableSuffix(), "[Atrium][Shortcut] " ) - object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderKeyValueExpectationsSpec( + object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderKeyValueExpectationsSpec( mfun2.() -> Unit>(C::contains), mfun2.() -> Unit)?>(C::contains).withNullableSuffix(), "[Atrium][Shortcut] " diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderKeyValuePairsExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderKeyValuePairsExpectationsSpec.kt index e2a52c598..664fdf48b 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderKeyValuePairsExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderKeyValuePairsExpectationsSpec.kt @@ -11,13 +11,13 @@ class MapContainsInAnyOrderKeyValuePairsExpectationsSpec : Spek({ include(BuilderSpec) include(ShortcutSpec) }) { - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderKeyValuePairsExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderKeyValuePairsExpectationsSpec( containsKeyValuePair_s to C::containsKeyValuePairs, (containsKeyValuePair_s to C::containsKeyValuePairsNullable).withNullableSuffix(), "[Atrium][Shortcut] " ) - object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderKeyValuePairsExpectationsSpec( + object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderKeyValuePairsExpectationsSpec( mfun2(C::contains), mfun2(C::contains).withNullableSuffix(), "[Atrium][Shortcut] " diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec.kt index 54ab27ca9..bf4cd6378 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec.kt @@ -15,13 +15,13 @@ class MapContainsInAnyOrderOnlyEntriesOfExpectationsSpec : Spek({ include(ShortcutMapLikeToIterablePairSpec) }) { - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec( containsKeyValuePair_s to C::containsKeyValuePairs, (containsKeyValuePair_s to C::containsKeyValuePairsNullable).withNullableSuffix(), "[Atrium][Builder] " ) - object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( + object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec( mfun2(C::containsOnlyEntriesOf), mfun2(C::containsOnlyEntriesOf).withNullableSuffix() ) diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderOnlyKeyValueExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderOnlyKeyValueExpectationsSpec.kt index e58aa8e06..5cff348ee 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderOnlyKeyValueExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderOnlyKeyValueExpectationsSpec.kt @@ -13,13 +13,13 @@ class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec : Spek({ include(ShortcutSpec) }) { - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderOnlyKeyValueExpectationsSpec( containsKeyValue_s to C::containsKeyValues, (containsKeyValue_s to C::containsKeyValuesNullable).withNullableSuffix(), "[Atrium][Builder] " ) - object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( + object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderOnlyKeyValueExpectationsSpec( mfun2.() -> Unit>(C::containsOnly), mfun2.() -> Unit)?>(C::containsOnly).withNullableSuffix(), "[Atrium][Shortcut] " diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt index 1c7d75bc6..9aab2cac1 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt @@ -12,13 +12,13 @@ class MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec : Spek({ include(ShortcutSpec) }) { - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec( containsKeyValuePair_s to C::containsKeyValuePairs, (containsKeyValuePair_s to C::containsKeyValuePairsNullable).withNullableSuffix(), "[Atrium][Builder] " ) - object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( + object ShortcutSpec : ch.tutteli.atrium.specs.integration.MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec( mfun2(C::containsInAnyOrderOnly), mfun2(C::containsInAnyOrderOnly).withNullableSuffix(), "[Atrium][Shortcut] " diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInOrderOnlyEntriesOfExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInOrderOnlyEntriesOfExpectationsSpec.kt index 313ebdd0f..ecd191dea 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInOrderOnlyEntriesOfExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInOrderOnlyEntriesOfExpectationsSpec.kt @@ -11,7 +11,7 @@ class MapContainsInOrderOnlyEntriesOfExpectationsSpec : Spek({ include(BuilderSpec) }) { - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInOrderOnlyKeyValuePairsExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInOrderOnlyKeyValuePairsExpectationsSpec( containsKeyValuePair_s to C::containsKeyValuePairs, (containsKeyValuePair_s to C::containsKeyValuePairsNullable).withNullableSuffix(), "[Atrium][Builder] " diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInOrderOnlyKeyValueExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInOrderOnlyKeyValueExpectationsSpec.kt index 01c746a91..426b99f85 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInOrderOnlyKeyValueExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInOrderOnlyKeyValueExpectationsSpec.kt @@ -10,7 +10,7 @@ class MapContainsInOrderOnlyKeyValueExpectationsSpec : Spek({ include(BuilderSpec) }) { - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInOrderOnlyKeyValueExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInOrderOnlyKeyValueExpectationsSpec( containsKeyValue_s to C::containsKeyValues, (containsKeyValue_s to C::containsKeyValuesNullable).withNullableSuffix(), "[Atrium][Builder] " diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInOrderOnlyKeyValuePairsExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInOrderOnlyKeyValuePairsExpectationsSpec.kt index 71b51dea1..6507bc509 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInOrderOnlyKeyValuePairsExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/MapContainsInOrderOnlyKeyValuePairsExpectationsSpec.kt @@ -10,7 +10,7 @@ class MapContainsInOrderOnlyKeyValuePairsExpectationsSpec : Spek({ include(BuilderSpec) }) { - object BuilderSpec : ch.tutteli.atrium.specs.integration.MapContainsInOrderOnlyKeyValuePairsExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.MapToContainInOrderOnlyKeyValuePairsExpectationsSpec( containsKeyValuePair_s to C::containsKeyValuePairs, (containsKeyValuePair_s to C::containsKeyValuePairsNullable).withNullableSuffix(), "[Atrium][Builder] " diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/AnyExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/AnyExpectationsSpec.kt index 83316feaa..54cb003c8 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/AnyExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/AnyExpectationsSpec.kt @@ -8,7 +8,7 @@ import ch.tutteli.atrium.core.polyfills.fullName import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.reporting.Text import ch.tutteli.atrium.specs.* -import ch.tutteli.atrium.specs.integration.MapLikeContainsSpecBase.Companion.separator +import ch.tutteli.atrium.specs.integration.MapLikeToContainSpecBase.Companion.separator import ch.tutteli.atrium.translations.DescriptionAnyAssertion.* import ch.tutteli.atrium.translations.DescriptionAnyAssertion.NOT_TO_BE import ch.tutteli.atrium.translations.DescriptionAnyAssertion.TO_BE diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapAsEntriesExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapAsEntriesExpectationsSpec.kt index 2783a0b77..ca25bff38 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapAsEntriesExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapAsEntriesExpectationsSpec.kt @@ -31,7 +31,7 @@ abstract class MapAsEntriesExpectationsSpec( toContain.inAnyOrder.only.entries( { isKeyValue("b", 2) }, { - key { toStartWith("a") } + key.toStartWith("a") value.toBeGreaterThanOrEqualTo(1) } ) diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapExpectationsSpec.kt index 91d50aeef..73978b7cc 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapExpectationsSpec.kt @@ -10,16 +10,16 @@ import org.spekframework.spek2.Spek import org.spekframework.spek2.style.specification.Suite abstract class MapExpectationsSpec( - containsKey: Fun1, String>, - containsKeyNullable: Fun1, String?>, - containsNotKey: Fun1, String>, - containsNotKeyNullable: Fun1, String?>, + toContainKey: Fun1, String>, + toContainKeyNullable: Fun1, String?>, + notToContainKey: Fun1, String>, + notToContainKeyNullable: Fun1, String?>, getExistingFeature: Feature1, String, Int>, getExisting: Fun2, String, Expect.() -> Unit>, getExistingNullableFeature: Feature1, String?, Int?>, getExistingNullable: Fun2, String?, Expect.() -> Unit>, - isEmpty: Fun0>, - isNotEmpty: Fun0>, + toBeEmpty: Fun0>, + notToBeEmpty: Fun0>, keys: Fun1, Expect>.() -> Unit>, keysFeature: Feature0, Set>, valuesFeature: Feature0, Collection>, @@ -33,10 +33,10 @@ abstract class MapExpectationsSpec( include(object : SubjectLessSpec>( describePrefix, - containsKey.forSubjectLess("a").unchecked1(), - containsNotKey.forSubjectLess("a").unchecked1(), - isEmpty.forSubjectLess().unchecked1(), - isNotEmpty.forSubjectLess().unchecked1(), + toContainKey.forSubjectLess("a").unchecked1(), + notToContainKey.forSubjectLess("a").unchecked1(), + toBeEmpty.forSubjectLess().unchecked1(), + notToBeEmpty.forSubjectLess().unchecked1(), keysFeature.forSubjectLess(), keys.forSubjectLess { this.toBeEmpty() }, valuesFeature.forSubjectLess(), @@ -47,8 +47,8 @@ abstract class MapExpectationsSpec( include(object : SubjectLessSpec>( "$describePrefix[nullable Key] ", - containsKeyNullable.forSubjectLess(null).unchecked1(), - containsNotKeyNullable.forSubjectLess(null).unchecked1(), + toContainKeyNullable.forSubjectLess(null).unchecked1(), + notToContainKeyNullable.forSubjectLess(null).unchecked1(), getExistingNullableFeature.forSubjectLess("a"), getExistingNullable.forSubjectLess("a") { toEqual(null) } ) {}) @@ -76,102 +76,102 @@ abstract class MapExpectationsSpec( val nullableFluent = expect(nullableMap) val empty = DescriptionCollectionAssertion.EMPTY.getDefault() - val containsKeyDescr = DescriptionMapLikeAssertion.CONTAINS_KEY.getDefault() - val containsNotKeyDescr = DescriptionMapLikeAssertion.CONTAINS_NOT_KEY.getDefault() + val toContainKeyDescr = DescriptionMapLikeAssertion.CONTAINS_KEY.getDefault() + val notToContainKeyDescr = DescriptionMapLikeAssertion.CONTAINS_NOT_KEY.getDefault() val keyDoesNotExist = DescriptionMapLikeAssertion.KEY_DOES_NOT_EXIST.getDefault() - describeFun(containsKey, containsKeyNullable, containsNotKey, containsNotKeyNullable) { - val containsKeyFunctions = uncheckedToNonNullable(containsKey, containsKeyNullable) - val containsNotKeyFunctions = uncheckedToNonNullable(containsNotKey, containsNotKeyNullable) + describeFun(toContainKey, toContainKeyNullable, notToContainKey, notToContainKeyNullable) { + val toContainKeyFunctions = uncheckedToNonNullable(toContainKey, toContainKeyNullable) + val notToContainKeyFunctions = uncheckedToNonNullable(notToContainKey, notToContainKeyNullable) val fluent2 = expect(map as Map) context("$map") { - containsKeyFunctions.forEach { (name, containsKeyFun) -> - it("$name - does not throw if the map contains the key") { - fluent2.containsKeyFun("a") + toContainKeyFunctions.forEach { (name, toContainKeyFun) -> + it("$name - does not throw if the map toContain the key") { + fluent2.toContainKeyFun("a") } it("$name - throws an AssertionError if the map does not contain the key") { expect { - fluent2.containsKeyFun("c") - }.toThrow { messageContains("$containsKeyDescr: \"c\"") } + fluent2.toContainKeyFun("c") + }.toThrow { messageContains("$toContainKeyDescr: \"c\"") } } - it("$name - does not throw if null is passed and the map contains null as key") { - fluent2.containsKeyFun("a") + it("$name - does not throw if null is passed and the map toContain null as key") { + fluent2.toContainKeyFun("a") } } - containsNotKeyFunctions.forEach { (name, containsNotKeyFun) -> + notToContainKeyFunctions.forEach { (name, notToContainKeyFun) -> it("$name - does not throw if the map does not contain the key") { - fluent2.containsNotKeyFun("c") + fluent2.notToContainKeyFun("c") } - it("$name - throws an AssertionError if the map contains the key") { + it("$name - throws an AssertionError if the map toContain the key") { expect { - fluent2.containsNotKeyFun("a") - }.toThrow { messageContains("$containsNotKeyDescr: \"a\"") } + fluent2.notToContainKeyFun("a") + }.toThrow { messageContains("$notToContainKeyDescr: \"a\"") } } } } } - describeFun(containsKeyNullable, containsNotKeyNullable) { - val containsNullableKeyFun = containsKeyNullable.lambda - val containsNotNullableKeyFun = containsNotKeyNullable.lambda + describeFun(toContainKeyNullable, notToContainKeyNullable) { + val toContainNullableKeyFun = toContainKeyNullable.lambda + val notToContainNullableKeyFun = notToContainKeyNullable.lambda val map2: Map = mapOf("a" to 1, null to 2) context("$map2") { - it("${containsKeyNullable.name} - does not throw if the map contains the key") { - expect(map2).containsNullableKeyFun(null) + it("${toContainKeyNullable.name} - does not throw if the map toContain the key") { + expect(map2).toContainNullableKeyFun(null) } - it("${containsNotKeyNullable.name} - throws an AssertionError if the map contains the key") { + it("${notToContainKeyNullable.name} - throws an AssertionError if the map toContain the key") { expect { - expect(map2).containsNotNullableKeyFun(null) - }.toThrow { messageContains("$containsNotKeyDescr: null") } + expect(map2).notToContainNullableKeyFun(null) + }.toThrow { messageContains("$notToContainKeyDescr: null") } } } val map3: Map = mapOf("a" to 1, "b" to 2) context("$map3") { - it("${containsKeyNullable.name} - throws an AssertionError if the map does not contain the key") { + it("${toContainKeyNullable.name} - throws an AssertionError if the map does not contain the key") { expect { - expect(map3).containsNullableKeyFun(null) - }.toThrow { messageContains("$containsKeyDescr: null") } + expect(map3).toContainNullableKeyFun(null) + }.toThrow { messageContains("$toContainKeyDescr: null") } } - it("${containsNotKeyNullable.name} - does not throw if the map does not contain the key") { - expect(map3).containsNotNullableKeyFun(null) + it("${notToContainKeyNullable.name} - does not throw if the map does not contain the key") { + expect(map3).notToContainNullableKeyFun(null) } } } - describeFun(isEmpty, isNotEmpty) { - val isEmptyFun = isEmpty.lambda - val isNotEmptyFun = isNotEmpty.lambda + describeFun(toBeEmpty, notToBeEmpty) { + val toBeEmptyFun = toBeEmpty.lambda + val notToBeEmptyFun = notToBeEmpty.lambda val map2: Map<*, *> = mapOf() context("empty Map") { - it("${isEmpty.name} - does not throw") { - expect(map2).isEmptyFun() + it("${toBeEmpty.name} - does not throw") { + expect(map2).toBeEmptyFun() } - it("${isNotEmpty.name} - throws an AssertionError") { + it("${notToBeEmpty.name} - throws an AssertionError") { expect { - expect(map2).isNotEmptyFun() + expect(map2).notToBeEmptyFun() }.toThrow { messageContains("$isNotDescr: $empty") } } } context("$map") { - it("${isEmpty.name} - throws an AssertionError") { + it("${toBeEmpty.name} - throws an AssertionError") { expect { - expect(map as Map<*, *>).isEmptyFun() + expect(map as Map<*, *>).toBeEmptyFun() }.toThrow { messageContains("$isDescr: $empty") } } - it("${isNotEmpty.name} - does not throw") { - expect(map as Map<*, *>).isNotEmptyFun() + it("${notToBeEmpty.name} - does not throw") { + expect(map as Map<*, *>).notToBeEmptyFun() } } } diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapLikeContainsFormatSpecBase.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapLikeToContainFormatSpecBase.kt similarity index 92% rename from misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapLikeContainsFormatSpecBase.kt rename to misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapLikeToContainFormatSpecBase.kt index 87eaa07e9..f6ff7334f 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapLikeContainsFormatSpecBase.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapLikeToContainFormatSpecBase.kt @@ -9,18 +9,18 @@ import ch.tutteli.atrium.translations.DescriptionCollectionAssertion import ch.tutteli.atrium.translations.DescriptionMapLikeAssertion import org.spekframework.spek2.dsl.Root -abstract class MapLikeContainsFormatSpecBase(spec: Root.() -> Unit) : MapLikeContainsSpecBase(spec) { +abstract class MapLikeToContainFormatSpecBase(spec: Root.() -> Unit) : MapLikeToContainSpecBase(spec) { companion object { val sizeDescr = DescriptionCollectionAssertion.SIZE.getDefault() val additionalEntriesDescr = DescriptionMapLikeAssertion.WARNING_ADDITIONAL_ENTRIES.getDefault() - fun Expect.containsSize(actual: Int, expected: Int) = + fun Expect.toContainsSize(actual: Int, expected: Int) = toContain.exactly(1) .regex("\\Q$rootBulletPoint$featureArrow$sizeDescr\\E: $actual[^:]+${DescriptionAnyAssertion.TO_BE.getDefault()}: $expected") - fun Expect.containsInAnyOrderOnlyDescr() = + fun Expect.toContainInAnyOrderOnlyDescr() = toContain.exactly(1).value( "$rootBulletPoint${ DescriptionMapLikeAssertion.IN_ANY_ORDER_ONLY.getDefault() @@ -29,7 +29,7 @@ abstract class MapLikeContainsFormatSpecBase(spec: Root.() -> Unit) : MapLikeCon ) - fun Expect.containsInOrderOnlyDescr() = + fun Expect.toContainInOrderOnlyDescr() = toContain.exactly(1).value( "$rootBulletPoint${ DescriptionMapLikeAssertion.IN_ORDER_ONLY.getDefault() diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapLikeContainsSpecBase.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapLikeToContainSpecBase.kt similarity index 88% rename from misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapLikeContainsSpecBase.kt rename to misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapLikeToContainSpecBase.kt index db494f495..2fd119d11 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapLikeContainsSpecBase.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapLikeToContainSpecBase.kt @@ -17,11 +17,11 @@ fun mfun2( f: KFunction3>, Pair, Array>, Expect>> ) = fun2(f) -abstract class MapLikeContainsSpecBase(spec: Root.() -> Unit) : Spek(spec) { +abstract class MapLikeToContainSpecBase(spec: Root.() -> Unit) : Spek(spec) { companion object { val keyDoesNotExist = DescriptionMapLikeAssertion.KEY_DOES_NOT_EXIST.getDefault() - val lessThanDescr = DescriptionComparableAssertion.IS_LESS_THAN.getDefault() + val toBeLessThanDescr = DescriptionComparableAssertion.IS_LESS_THAN.getDefault() val separator = lineSeparator diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInAnyOrderKeyValueExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInAnyOrderKeyValueExpectationsSpec.kt similarity index 87% rename from misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInAnyOrderKeyValueExpectationsSpec.kt rename to misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInAnyOrderKeyValueExpectationsSpec.kt index 7d387ad7b..60c5e7478 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInAnyOrderKeyValueExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInAnyOrderKeyValueExpectationsSpec.kt @@ -14,11 +14,11 @@ fun keyNullableValue( assertionCreator: (Expect.() -> Unit)? ): Pair.() -> Unit)?> = key to assertionCreator -abstract class MapContainsInAnyOrderKeyValueExpectationsSpec( +abstract class MapToContainInAnyOrderKeyValueExpectationsSpec( keyWithValueAssertions: MFun2.() -> Unit>, keyWithNullableValueAssertions: MFun2.() -> Unit)?>, describePrefix: String = "[Atrium] " -) : MapLikeContainsSpecBase({ +) : MapLikeToContainSpecBase({ include(object : SubjectLessSpec>( describePrefix, @@ -56,14 +56,14 @@ abstract class MapContainsInAnyOrderKeyValueExpectationsSpec( describeFunTemplate(describePrefix, pairs.map { it.name }.toTypedArray(), body = body) describeFun(keyWithValueAssertions, keyWithNullableValueAssertions) { - val containsKeyWithValueAssertionsFunctions = uncheckedToNonNullable( + val toContainKeyWithValueAssertionsFunctions = uncheckedToNonNullable( keyWithValueAssertions, keyWithNullableValueAssertions ) val fluent = expect(map) context("map $map") { - containsKeyWithValueAssertionsFunctions.forEach { (name, containsKeyWithValueAssertionsFun) -> + toContainKeyWithValueAssertionsFunctions.forEach { (name, toContainKeyWithValueAssertionsFun) -> listOf( "a { toBe(1) }" to listOf(keyValue("a") { toEqual(1) }), "b { toBe(2) }" to listOf(keyValue("b") { toEqual(2) }), @@ -71,12 +71,12 @@ abstract class MapContainsInAnyOrderKeyValueExpectationsSpec( "b { toBe(2) }, a { toBe(1) }" to listOf(keyValue("b") { toEqual(2) }, keyValue("a") { toEqual(1) }) ).forEach { (description, keyValues) -> it("$name - $description does not throw") { - fluent.containsKeyWithValueAssertionsFun(keyValues.first(), keyValues.drop(1).toTypedArray()) + fluent.toContainKeyWithValueAssertionsFun(keyValues.first(), keyValues.drop(1).toTypedArray()) } } it("$name - a { isLessThan(2) } and a { isGreaterThan(0) } does not throw (no unique match)") { - fluent.containsKeyWithValueAssertionsFun( + fluent.toContainKeyWithValueAssertionsFun( keyValue("a") { toBeLessThan(2) }, arrayOf(keyValue("a") { toBeGreaterThan(0) }) ) @@ -84,7 +84,7 @@ abstract class MapContainsInAnyOrderKeyValueExpectationsSpec( it("$name - a { isLessThan(3) }, b { isLessThan(2) }, c { isLessThan(1) }} throws AssertionError, reports b and c") { expect { - fluent.containsKeyWithValueAssertionsFun( + fluent.toContainKeyWithValueAssertionsFun( keyValue("a") { toBeLessThan(3) }, arrayOf(keyValue("b") { toBeLessThan(2) }, keyValue("c") { toBeLessThan(1) }) ) @@ -92,9 +92,9 @@ abstract class MapContainsInAnyOrderKeyValueExpectationsSpec( message { toContain( entry("b", 2), - "$lessThanDescr: 2", + "$toBeLessThanDescr: 2", entry("c", keyDoesNotExist), - "$lessThanDescr: 1" + "$toBeLessThanDescr: 1" ) notToContain(entry("a")) } @@ -105,7 +105,7 @@ abstract class MapContainsInAnyOrderKeyValueExpectationsSpec( } describeFun(keyWithNullableValueAssertions) { - val containsFun = keyWithNullableValueAssertions.lambda + val toContainFun = keyWithNullableValueAssertions.lambda val nullableFluent = expect(nullableMap) context("map $nullableMap") { @@ -135,13 +135,13 @@ abstract class MapContainsInAnyOrderKeyValueExpectationsSpec( ) ).forEach { (description, keyValues) -> it("$description does not throw") { - nullableFluent.containsFun(keyValues.first(), keyValues.drop(1).toTypedArray()) + nullableFluent.toContainFun(keyValues.first(), keyValues.drop(1).toTypedArray()) } } it("(a, null), b { isLessThan(2) }, c { isLessThan(1) }} throws AssertionError, reports b and c") { expect { - nullableFluent.containsFun( + nullableFluent.toContainFun( keyNullableValue("a", null), arrayOf( keyNullableValue("b") { toBeLessThan(2) }, keyNullableValue("c") { toBeLessThan(1) } @@ -151,9 +151,9 @@ abstract class MapContainsInAnyOrderKeyValueExpectationsSpec( message { toContain( entry("b", 2), - "$lessThanDescr: 2", + "$toBeLessThanDescr: 2", entry("c", keyDoesNotExist), - "$lessThanDescr: 1" + "$toBeLessThanDescr: 1" ) notToContain(entry("a")) } diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInAnyOrderKeyValuePairsExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInAnyOrderKeyValuePairsExpectationsSpec.kt similarity index 78% rename from misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInAnyOrderKeyValuePairsExpectationsSpec.kt rename to misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInAnyOrderKeyValuePairsExpectationsSpec.kt index 27cdebae7..d56f40c8c 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInAnyOrderKeyValuePairsExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInAnyOrderKeyValuePairsExpectationsSpec.kt @@ -2,17 +2,15 @@ package ch.tutteli.atrium.specs.integration import ch.tutteli.atrium.api.fluent.en_GB.* import ch.tutteli.atrium.api.verbs.internal.expect -import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.specs.* import org.spekframework.spek2.style.specification.Suite -import kotlin.reflect.KFunction3 -abstract class MapContainsInAnyOrderKeyValuePairsExpectationsSpec( +abstract class MapToContainInAnyOrderKeyValuePairsExpectationsSpec( keyValuePairs: MFun2, keyValuePairsNullable: MFun2, describePrefix: String = "[Atrium] " -) : MapLikeContainsSpecBase({ +) : MapLikeToContainSpecBase({ include(object : SubjectLessSpec>( describePrefix, @@ -31,10 +29,10 @@ abstract class MapContainsInAnyOrderKeyValuePairsExpectationsSpec( val nullableFluent = expect(nullableMap) describeFun(keyValuePairs, keyValuePairsNullable) { - val containsFunctions = uncheckedToNonNullable(keyValuePairs, keyValuePairsNullable) + val toContainFunctions = uncheckedToNonNullable(keyValuePairs, keyValuePairsNullable) context("map $map") { - containsFunctions.forEach { (name, containsFun) -> + toContainFunctions.forEach { (name, toContainFun) -> listOf( listOf("a" to 1), listOf("b" to 2), @@ -42,17 +40,17 @@ abstract class MapContainsInAnyOrderKeyValuePairsExpectationsSpec( listOf("b" to 2, "a" to 1) ).forEach { it("$name - $it does not throw") { - fluent.containsFun(it.first(), it.drop(1).toTypedArray()) + fluent.toContainFun(it.first(), it.drop(1).toTypedArray()) } } it("$name - a to 1 and a to 1 does not throw (no unique match)") { - fluent.containsFun("a" to 1, arrayOf("a" to 1)) + fluent.toContainFun("a" to 1, arrayOf("a" to 1)) } it("$name - {a to 1, b to 3, c to 4} throws AssertionError, reports b and c") { expect { - fluent.containsFun("a" to 1, arrayOf("b" to 3, "c" to 4)) + fluent.toContainFun("a" to 1, arrayOf("b" to 3, "c" to 4)) }.toThrow { message { toContain( @@ -70,7 +68,7 @@ abstract class MapContainsInAnyOrderKeyValuePairsExpectationsSpec( } describeFun(keyValuePairsNullable) { - val containsNullableFun = keyValuePairsNullable.lambda + val toContainNullableFun = keyValuePairsNullable.lambda context("map $nullableMap") { listOf( listOf("a" to null), @@ -83,17 +81,17 @@ abstract class MapContainsInAnyOrderKeyValuePairsExpectationsSpec( listOf("b" to 2, null to 1, "a" to null) ).forEach { it("$it does not throw") { - nullableFluent.containsNullableFun(it.first(), it.drop(1).toTypedArray()) + nullableFluent.toContainNullableFun(it.first(), it.drop(1).toTypedArray()) } } it("a to null and a to null does not throw (no unique match)") { - nullableFluent.containsNullableFun("a" to null, arrayOf("a" to null)) + nullableFluent.toContainNullableFun("a" to null, arrayOf("a" to null)) } it("{a to null, null to 2, b to 3, c to 4} throws AssertionError, reports a, null, b and c") { expect { - nullableFluent.containsNullableFun("a" to null, arrayOf(null to 2, "b" to 3, "c" to 4)) + nullableFluent.toContainNullableFun("a" to null, arrayOf(null to 2, "b" to 3, "c" to 4)) }.toThrow { message { toContain( diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInAnyOrderOnlyKeyValueExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInAnyOrderOnlyKeyValueExpectationsSpec.kt similarity index 77% rename from misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInAnyOrderOnlyKeyValueExpectationsSpec.kt rename to misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInAnyOrderOnlyKeyValueExpectationsSpec.kt index 6e79e612e..5f5dd77d1 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInAnyOrderOnlyKeyValueExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInAnyOrderOnlyKeyValueExpectationsSpec.kt @@ -6,11 +6,11 @@ import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.specs.* import org.spekframework.spek2.style.specification.Suite -abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( +abstract class MapToContainInAnyOrderOnlyKeyValueExpectationsSpec( keyWithValueAssertions: MFun2.() -> Unit>, keyWithNullableValueAssertions: MFun2.() -> Unit)?>, describePrefix: String = "[Atrium] " -) : MapLikeContainsFormatSpecBase({ +) : MapLikeToContainFormatSpecBase({ include( object : SubjectLessSpec>( @@ -33,7 +33,7 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( include( object : AssertionCreatorSpec>( describePrefix, map, - assertionCreatorSpecTriple(keyWithValueAssertions.name, "$lessThanDescr: 2", + assertionCreatorSpecTriple(keyWithValueAssertions.name, "$toBeLessThanDescr: 2", { keyWithValueAssertions( this, @@ -48,7 +48,7 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( include( object : AssertionCreatorSpec>( "$describePrefix[nullable] ", mapOf("a" to 1, "b" to null), - assertionCreatorSpecTriple(keyWithNullableValueAssertions.name, "$lessThanDescr: 2", + assertionCreatorSpecTriple(keyWithNullableValueAssertions.name, "$toBeLessThanDescr: 2", { keyWithNullableValueAssertions( this, @@ -66,19 +66,19 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( describeFun(keyWithValueAssertions, keyWithValueAssertions) { - val containsKeyWithValueAssertionsFunctions = + val toContainKeyWithValueAssertionsFunctions = uncheckedToNonNullable(keyWithValueAssertions, keyWithNullableValueAssertions) val emptyMap: Map = mapOf() context("empty map") { - containsKeyWithValueAssertionsFunctions.forEach { (name, containsFun) -> + toContainKeyWithValueAssertionsFunctions.forEach { (name, toContainFun) -> it("$name - a to { toBe(1) } throws AssertionError, reports a") { expect { - expect(emptyMap).containsFun(keyValue("a") { toEqual(1) }, arrayOf()) + expect(emptyMap).toContainFun(keyValue("a") { toEqual(1) }, arrayOf()) }.toThrow { message { - containsInAnyOrderOnlyDescr() - containsSize(0, 1) + toContainInAnyOrderOnlyDescr() + toContainsSize(0, 1) entryNonExisting("a", "$toBeDescr: 1") notToContain(additionalEntriesDescr) } @@ -87,7 +87,7 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( it("$name - a to { isLessThan(1) }, b to { toBe(3) }, c to { isLessThan(4) } } throws AssertionError, reports a, b and c") { expect { - expect(emptyMap).containsFun( + expect(emptyMap).toContainFun( keyValue("a") { toBeLessThan(1) }, arrayOf( keyValue("b") { toEqual(3) }, @@ -95,11 +95,11 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( )) }.toThrow { message { - containsInAnyOrderOnlyDescr() - containsSize(0, 3) - entryNonExisting("a", "$lessThanDescr: 1") + toContainInAnyOrderOnlyDescr() + toContainsSize(0, 3) + entryNonExisting("a", "$toBeLessThanDescr: 1") entryNonExisting("b", "$toBeDescr: 3") - entryNonExisting("c", "$lessThanDescr: 4") + entryNonExisting("c", "$toBeLessThanDescr: 4") notToContain(additionalEntriesDescr) } } @@ -108,7 +108,7 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( } context("map $map") { - containsKeyWithValueAssertionsFunctions.forEach { (name, containsFun) -> + toContainKeyWithValueAssertionsFunctions.forEach { (name, toContainFun) -> listOf( "a to { toBe(1) }, b to { toBe(2) }" to listOf( keyValue("a") { toEqual(1) }, @@ -124,18 +124,18 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( keyValue("b") { toBeLessThan(3) }) ).forEach { (description, list) -> it("$name - $description does not throw") { - expect(map).containsFun(list.first(), list.drop(1).toTypedArray()) + expect(map).toContainFun(list.first(), list.drop(1).toTypedArray()) } } it("$name - a to { isLessThan(2) } throws AssertionError, reports second a and missing b") { expect { - expect(map).containsFun(keyValue("a") { toBeLessThan(2) }, arrayOf()) + expect(map).toContainFun(keyValue("a") { toBeLessThan(2) }, arrayOf()) }.toThrow { message { - containsInAnyOrderOnlyDescr() - containsSize(2, 1) - entrySuccess("a", 1, "$lessThanDescr: 2") + toContainInAnyOrderOnlyDescr() + toContainsSize(2, 1) + entrySuccess("a", 1, "$toBeLessThanDescr: 2") additionalEntries("b" to 2) } } @@ -143,11 +143,11 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( it("$name - a to { isLessThan(2) }, a to { toBe(1) } throws AssertionError, reports second a and missing b") { expect { - expect(map).containsFun(keyValue("a") { toBeLessThan(2) }, arrayOf(keyValue("a") { toEqual(1) })) + expect(map).toContainFun(keyValue("a") { toBeLessThan(2) }, arrayOf(keyValue("a") { toEqual(1) })) }.toThrow { message { - containsInAnyOrderOnlyDescr() - entrySuccess("a", 1, "$lessThanDescr: 2") + toContainInAnyOrderOnlyDescr() + entrySuccess("a", 1, "$toBeLessThanDescr: 2") entryNonExisting("a", "$toBeDescr: 1") additionalEntries("b" to 2) @@ -158,7 +158,7 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( it("$name - a to { isLessThan(3), b to { isLessThan(1), c to { toBe(4) } throws AssertionError, reports b and c") { expect { - expect(map).containsFun( + expect(map).toContainFun( keyValue("a") { toBeLessThan(3) }, arrayOf( keyValue("b") { toBeLessThan(1) }, @@ -167,10 +167,10 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( ) }.toThrow { message { - containsInAnyOrderOnlyDescr() - containsSize(2, 3) - entrySuccess("a", 1, "$lessThanDescr: 3") - entryFailing("b", 2, "$lessThanDescr: 1") + toContainInAnyOrderOnlyDescr() + toContainsSize(2, 3) + entrySuccess("a", 1, "$toBeLessThanDescr: 3") + entryFailing("b", 2, "$toBeLessThanDescr: 1") entryNonExisting("c", "$toBeDescr: 4") notToContain(additionalEntriesDescr) @@ -183,7 +183,7 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( describeFun(keyWithNullableValueAssertions) { - val containsKeyWithNullableValueAssertionsFun = keyWithNullableValueAssertions.lambda + val toContainKeyWithNullableValueAssertionsFun = keyWithNullableValueAssertions.lambda context("map: $nullableMap") { listOf( "null { toBe(1) }, (a, null), b{ toBe(2) }" to @@ -199,7 +199,7 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( ) ).forEach { (description, keyValues) -> it("$description does not throw") { - expect(nullableMap).containsKeyWithNullableValueAssertionsFun( + expect(nullableMap).toContainKeyWithNullableValueAssertionsFun( keyValues.first(), keyValues.drop(1).toTypedArray() ) @@ -207,14 +207,14 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( } it("a to { toBe(1) } throws AssertionError, reports failure and missing null and b") { expect { - expect(nullableMap).containsKeyWithNullableValueAssertionsFun( + expect(nullableMap).toContainKeyWithNullableValueAssertionsFun( keyNullableValue("a") { toEqual(1) }, arrayOf() ) }.toThrow { message { - containsInAnyOrderOnlyDescr() - containsSize(3, 1) + toContainInAnyOrderOnlyDescr() + toContainsSize(3, 1) entryFailingExplaining("a", null, "$toBeDescr: 1") additionalEntries(null to 1, "b" to 2) } @@ -223,7 +223,7 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( it("a to { toBe(1) }, c to { isLessThan(3) }, null to null, b to { isLessThan(3) } throws AssertionError, reports all but b") { expect { - expect(nullableMap).containsKeyWithNullableValueAssertionsFun( + expect(nullableMap).toContainKeyWithNullableValueAssertionsFun( keyNullableValue("a") { toEqual(1) }, arrayOf( keyNullableValue("c") { toBeLessThan(3) }, @@ -233,12 +233,12 @@ abstract class MapContainsInAnyOrderOnlyKeyValueExpectationsSpec( ) }.toThrow { message { - containsInAnyOrderOnlyDescr() - containsSize(3, 4) + toContainInAnyOrderOnlyDescr() + toContainsSize(3, 4) entryFailingExplaining("a", null, "$toBeDescr: 1") - entryNonExisting("c", "$lessThanDescr: 3") + entryNonExisting("c", "$toBeLessThanDescr: 3") entryFailing(null, "1", "$toBeDescr: null") - entrySuccess("b", "2", "$lessThanDescr: 3") + entrySuccess("b", "2", "$toBeLessThanDescr: 3") notToContain(additionalEntriesDescr) } diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt similarity index 72% rename from misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt rename to misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt index 00a78607b..4d45ae8bc 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec.kt @@ -5,11 +5,11 @@ import ch.tutteli.atrium.api.verbs.internal.expect import ch.tutteli.atrium.specs.* import org.spekframework.spek2.style.specification.Suite -abstract class MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( +abstract class MapToContainInAnyOrderOnlyKeyValuePairsExpectationsSpec( keyValuePairs: MFun2, keyValuePairsNullable: MFun2, describePrefix: String = "[Atrium] " -) : MapLikeContainsFormatSpecBase({ +) : MapLikeToContainFormatSpecBase({ include(object : SubjectLessSpec>( describePrefix, @@ -25,17 +25,17 @@ abstract class MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( describeFunTemplate(describePrefix, pairs.map { it.name }.toTypedArray(), body = body) describeFun(keyValuePairs, keyValuePairsNullable) { - val containsKeyValuePairsFunctions = uncheckedToNonNullable(keyValuePairs, keyValuePairsNullable) + val toContainKeyValuePairsFunctions = uncheckedToNonNullable(keyValuePairs, keyValuePairsNullable) context("empty map") { - containsKeyValuePairsFunctions.forEach { (name, containsFun) -> + toContainKeyValuePairsFunctions.forEach { (name, toContainFun) -> it("$name - a to 1 throws AssertionError, reports a") { expect { - expect(emptyMap).containsFun("a" to 1, arrayOf()) + expect(emptyMap).toContainFun("a" to 1, arrayOf()) }.toThrow { message { - containsInAnyOrderOnlyDescr() - containsSize(0, 1) + toContainInAnyOrderOnlyDescr() + toContainsSize(0, 1) entryNonExisting("a", "$toBeDescr: 1") } } @@ -43,11 +43,11 @@ abstract class MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( it("$name - a to 1, b to 3, c to 4 throws AssertionError, reports a, b and c") { expect { - expect(emptyMap).containsFun("a" to 1, arrayOf("b" to 3, "c" to 4)) + expect(emptyMap).toContainFun("a" to 1, arrayOf("b" to 3, "c" to 4)) }.toThrow { message { - containsInAnyOrderOnlyDescr() - containsSize(0, 3) + toContainInAnyOrderOnlyDescr() + toContainsSize(0, 3) entryNonExisting("a", "$toBeDescr: 1") entryNonExisting("b", "$toBeDescr: 3") entryNonExisting("c", "$toBeDescr: 4") @@ -58,23 +58,23 @@ abstract class MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( } context("map $map") { - containsKeyValuePairsFunctions.forEach { (name, containsFun) -> + toContainKeyValuePairsFunctions.forEach { (name, toContainFun) -> listOf( listOf("a" to 1, "b" to 2), listOf("b" to 2, "a" to 1) ).forEach { it("$name - ${it.joinToString()} does not throw") { - expect(map).containsFun(it.first(), it.drop(1).toTypedArray()) + expect(map).toContainFun(it.first(), it.drop(1).toTypedArray()) } } it("$name - a to 1 throws AssertionError, reports second a and missing b") { expect { - expect(map).containsFun("a" to 1, arrayOf()) + expect(map).toContainFun("a" to 1, arrayOf()) }.toThrow { message { - containsSize(2, 1) - containsInAnyOrderOnlyDescr() + toContainsSize(2, 1) + toContainInAnyOrderOnlyDescr() entrySuccess("a", 1, "$toBeDescr: 1") additionalEntries("b" to 2) } @@ -83,10 +83,10 @@ abstract class MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( it("$name - a to 1, a to 1 throws AssertionError, reports second a and missing b") { expect { - expect(map).containsFun("a" to 1, arrayOf("a" to 1)) + expect(map).toContainFun("a" to 1, arrayOf("a" to 1)) }.toThrow { message { - containsInAnyOrderOnlyDescr() + toContainInAnyOrderOnlyDescr() entrySuccess("a", 1, "$toBeDescr: 1") entryNonExisting("a", "$toBeDescr: 1") additionalEntries("b" to 2) @@ -97,11 +97,11 @@ abstract class MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( it("$name - a to 1, b to 3, c to 4 throws AssertionError, reports b and c") { expect { - expect(map).containsFun("a" to 1, arrayOf("b" to 3, "c" to 4)) + expect(map).toContainFun("a" to 1, arrayOf("b" to 3, "c" to 4)) }.toThrow { message { - containsInAnyOrderOnlyDescr() - containsSize(2, 3) + toContainInAnyOrderOnlyDescr() + toContainsSize(2, 3) entrySuccess("a", 1, "$toBeDescr: 1") entryFailing("b", 2, "$toBeDescr: 3") entryNonExisting("c", "$toBeDescr: 4") @@ -114,7 +114,7 @@ abstract class MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( } describeFun(keyValuePairsNullable) { - val containsFun = keyValuePairsNullable.lambda + val toContainFun = keyValuePairsNullable.lambda context("map: $nullableMap") { listOf( listOf("a" to null, null to 1, "b" to 2), @@ -123,16 +123,16 @@ abstract class MapContainsInAnyOrderOnlyKeyValuePairsExpectationsSpec( listOf(null to 1, "a" to null, "b" to 2) ).forEach { it("$it does not throw") { - expect(nullableMap).containsFun(it.first(), it.drop(1).toTypedArray()) + expect(nullableMap).toContainFun(it.first(), it.drop(1).toTypedArray()) } } it("a to 1, c to 3, null to null, b to 2 throws AssertionError, reports all but b") { expect { - expect(nullableMap).containsFun("a" to 1, arrayOf("c" to 3, null to null, "b" to 2)) + expect(nullableMap).toContainFun("a" to 1, arrayOf("c" to 3, null to null, "b" to 2)) }.toThrow { message { - containsInAnyOrderOnlyDescr() - containsSize(3, 4) + toContainInAnyOrderOnlyDescr() + toContainsSize(3, 4) entryFailing("a", null, "$toBeDescr: 1") entryNonExisting("c", "$toBeDescr: 3") entryFailing(null, "1", "$toBeDescr: null") diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInOrderOnlyKeyValueExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInOrderOnlyKeyValueExpectationsSpec.kt similarity index 83% rename from misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInOrderOnlyKeyValueExpectationsSpec.kt rename to misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInOrderOnlyKeyValueExpectationsSpec.kt index d341eb9a8..1d7b452a2 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInOrderOnlyKeyValueExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInOrderOnlyKeyValueExpectationsSpec.kt @@ -6,11 +6,11 @@ import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.specs.* import org.spekframework.spek2.style.specification.Suite -abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( +abstract class MapToContainInOrderOnlyKeyValueExpectationsSpec( keyWithValueAssertions: MFun2.() -> Unit>, keyWithNullableValueAssertions: MFun2.() -> Unit)?>, describePrefix: String = "[Atrium] " -) : MapLikeContainsFormatSpecBase({ +) : MapLikeToContainFormatSpecBase({ include(object : SubjectLessSpec>( describePrefix, @@ -30,7 +30,7 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( include(object : AssertionCreatorSpec>( describePrefix, map, - assertionCreatorSpecTriple(keyWithValueAssertions.name, "$lessThanDescr: 2", + assertionCreatorSpecTriple(keyWithValueAssertions.name, "$toBeLessThanDescr: 2", { keyWithValueAssertions( this, @@ -44,7 +44,7 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( include(object : AssertionCreatorSpec>( "$describePrefix[nullable] ", mapOf("a" to 1, "b" to null), - assertionCreatorSpecTriple(keyWithNullableValueAssertions.name, "$lessThanDescr: 2", + assertionCreatorSpecTriple(keyWithNullableValueAssertions.name, "$toBeLessThanDescr: 2", { keyWithNullableValueAssertions( this, @@ -129,21 +129,21 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( } describeFun(keyWithValueAssertions, keyWithNullableValueAssertions) { - val containsKeyWithValueAssertionsFunctions = uncheckedToNonNullable( + val toContainKeyWithValueAssertionsFunctions = uncheckedToNonNullable( keyWithValueAssertions, keyWithNullableValueAssertions ) context("empty map") { - containsKeyWithValueAssertionsFunctions.forEach { (name, containsFun) -> + toContainKeyWithValueAssertionsFunctions.forEach { (name, toContainFun) -> it("$name - a to { toBe(1) } throws AssertionError, reports a") { expect { - expect(emptyMap).containsFun(keyValue("a") { toEqual(1) }, arrayOf()) + expect(emptyMap).toContainFun(keyValue("a") { toEqual(1) }, arrayOf()) }.toThrow { message { - containsInOrderOnlyDescr() - // TODO 0.18.0 wait for size to be moved out of Iterable.contains - //containsSize(0, 1) + toContainInOrderOnlyDescr() + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain + //toContainsSize(0, 1) elementOutOfBound(0, "a", "$toBeDescr: 1") } } @@ -151,7 +151,7 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( it("$name - a to { isLessThan(1) }, b to { toBe(3) }, c to { isLessThan(4) } } throws AssertionError, reports a, b and c") { expect { - expect(emptyMap).containsFun( + expect(emptyMap).toContainFun( keyValue("a") { toBeLessThan(1) }, arrayOf( keyValue("b") { toEqual(3) }, @@ -159,12 +159,12 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( )) }.toThrow { message { - containsInOrderOnlyDescr() - // TODO 0.18.0 wait for size to be moved out of Iterable.contains - //containsSize(0, 3) - elementOutOfBound(0, "a", "$lessThanDescr: 1") + toContainInOrderOnlyDescr() + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain + //toContainsSize(0, 3) + elementOutOfBound(0, "a", "$toBeLessThanDescr: 1") elementOutOfBound(1, "b", "$toBeDescr: 3") - elementOutOfBound(2, "c", "$lessThanDescr: 4") + elementOutOfBound(2, "c", "$toBeLessThanDescr: 4") } } } @@ -174,7 +174,7 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( context("map $map") { val fluent = expect(map) - containsKeyWithValueAssertionsFunctions.forEach { (name, containsFun) -> + toContainKeyWithValueAssertionsFunctions.forEach { (name, toContainFun) -> listOf( "a to { toBe(1) }, b to { toBe(2) }" to listOf( keyValue("a") { toEqual(1) }, @@ -184,13 +184,13 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( keyValue("b") { toBeLessThan(3) }) ).forEach { (description, list) -> it("$name - $description does not throw") { - expect(map).containsFun(list.first(), list.drop(1).toTypedArray()) + expect(map).toContainFun(list.first(), list.drop(1).toTypedArray()) } } it("$name - a to { toBe(1) } throws AssertionError, missing b") { expect { - fluent.containsFun( + fluent.toContainFun( keyValue("a") { toEqual(1) }, arrayOf() ) @@ -198,15 +198,15 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( message { elementSuccess(0, "a=1", "a", "$toBeDescr: 1") additionalEntries(1 to "b=2") - // TODO 0.18.0 wait for size to be moved out of Iterable.contains -// containsSize(2, 1) + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain +// toContainsSize(2, 1) } } } it("$name - b to { toBe(2) }, a to { toBe(1) } throws AssertionError, wrong order") { expect { - fluent.containsFun( + fluent.toContainFun( keyValue("b") { toEqual(2) }, arrayOf(keyValue("a") { toEqual(1) }) ) @@ -215,8 +215,8 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( elementFailing(0, "a=1", "b", "$toBeDescr: 2") elementFailing(1, "b=2", "a", "$toBeDescr: 1") - // TODO 0.18.0 wait for size to be moved out of Iterable.contains -// containsNot(sizeDescr) + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain +// toContainNot(sizeDescr) notToContain(additionalEntriesDescr) } } @@ -224,15 +224,15 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( it("$name - a { isLessThan(3) }, b { isLessThan(2) }, c { isLessThan(1) }} throws AssertionError, reports b and c") { expect { - fluent.containsFun( + fluent.toContainFun( keyValue("a") { toBeLessThan(3) }, arrayOf(keyValue("b") { toBeLessThan(2) }, keyValue("c") { toBeLessThan(1) }) ) }.toThrow { message { - elementSuccess(0, "a=1", "a", "$lessThanDescr: 3") - elementFailing(1, "b=2", "b", "$lessThanDescr: 2") - elementOutOfBound(2, "c", "$lessThanDescr: 1") + elementSuccess(0, "a=1", "a", "$toBeLessThanDescr: 3") + elementFailing(1, "b=2", "b", "$toBeLessThanDescr: 2") + elementOutOfBound(2, "c", "$toBeLessThanDescr: 1") notToContain(additionalEntriesDescr) } } @@ -242,7 +242,7 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( } describeFun(keyWithNullableValueAssertions) { - val containsFun = keyWithNullableValueAssertions.lambda + val toContainFun = keyWithNullableValueAssertions.lambda val nullableFluent = expect(nullableMap) context("map $nullableMap") { @@ -261,7 +261,7 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( ) ).forEach { (description, keyValues) -> it("$description does not throw") { - nullableFluent.containsFun( + nullableFluent.toContainFun( keyValues.first(), keyValues.drop(1).toTypedArray() ) @@ -270,20 +270,20 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( it("(a, null) throws AssertionError, missing b") { expect { - nullableFluent.containsFun(keyNullableValue("a", null), arrayOf()) + nullableFluent.toContainFun(keyNullableValue("a", null), arrayOf()) }.toThrow { message { elementSuccess(0, "a=null", "a", "$toBeDescr: null") additionalEntries(1 to "null=1", 2 to "b=2") - // TODO 0.18.0 wait for size to be moved out of Iterable.contains -// containsSize(3, 1) + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain +// toContainsSize(3, 1) } } } it("b to { toBe(2) }, (a, null), null to { toBe(1) } throws AssertionError, wrong order") { expect { - nullableFluent.containsFun( + nullableFluent.toContainFun( keyNullableValue("b") { toEqual(2) }, arrayOf( keyNullableValue("a", null), @@ -296,8 +296,8 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( elementFailing(1, "null=1", "a", "$toBeDescr: null") elementFailing(2, "b=2", null, "$toBeDescr: 1") - // TODO 0.18.0 wait for size to be moved out of Iterable.contains -// containsNot(sizeDescr) + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain +// toContainNot(sizeDescr) notToContain(additionalEntriesDescr) } @@ -307,7 +307,7 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( it("(a, null), c { isLessThan(1) }, b { isLessThan(2) } throws AssertionError, reports b and c") { expect { - nullableFluent.containsFun( + nullableFluent.toContainFun( keyNullableValue("a", null), arrayOf( keyNullableValue("c") { toBeLessThan(1) }, keyNullableValue("b") { toBeLessThan(2) } @@ -316,11 +316,11 @@ abstract class MapContainsInOrderOnlyKeyValueExpectationsSpec( }.toThrow { message { elementSuccess(0, "a=null", "a", "$toBeDescr: null") - elementFailing(1, "null=1", "c", "$lessThanDescr: 1") - elementFailing(2, "b=2", "b", "$lessThanDescr: 2") + elementFailing(1, "null=1", "c", "$toBeLessThanDescr: 1") + elementFailing(2, "b=2", "b", "$toBeLessThanDescr: 2") - // TODO 0.18.0 wait for size to be moved out of Iterable.contains -// containsNot(sizeDescr) + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain +// toContainNot(sizeDescr) notToContain(additionalEntriesDescr) } } diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInOrderOnlyKeyValuePairsExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInOrderOnlyKeyValuePairsExpectationsSpec.kt similarity index 81% rename from misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInOrderOnlyKeyValuePairsExpectationsSpec.kt rename to misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInOrderOnlyKeyValuePairsExpectationsSpec.kt index 53b3c5c49..02fdfc0c9 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapContainsInOrderOnlyKeyValuePairsExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/MapToContainInOrderOnlyKeyValuePairsExpectationsSpec.kt @@ -6,11 +6,11 @@ import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.specs.* import org.spekframework.spek2.style.specification.Suite -abstract class MapContainsInOrderOnlyKeyValuePairsExpectationsSpec( +abstract class MapToContainInOrderOnlyKeyValuePairsExpectationsSpec( keyValuePairs: MFun2, keyValuePairsNullable: MFun2, describePrefix: String = "[Atrium] " -) : MapLikeContainsFormatSpecBase({ +) : MapLikeToContainFormatSpecBase({ include(object : SubjectLessSpec>( describePrefix, @@ -95,18 +95,18 @@ abstract class MapContainsInOrderOnlyKeyValuePairsExpectationsSpec( } describeFun(keyValuePairs, keyValuePairsNullable) { - val containsKeyValuePairsFunctions = uncheckedToNonNullable(keyValuePairs, keyValuePairsNullable) + val toContainKeyValuePairsFunctions = uncheckedToNonNullable(keyValuePairs, keyValuePairsNullable) context("empty map") { - containsKeyValuePairsFunctions.forEach { (name, containsFun) -> + toContainKeyValuePairsFunctions.forEach { (name, toContainFun) -> it("$name - a to 1 throws AssertionError, reports a") { expect { - expect(emptyMap).containsFun("a" to 1, arrayOf()) + expect(emptyMap).toContainFun("a" to 1, arrayOf()) }.toThrow { message { - containsInOrderOnlyDescr() - // TODO 0.18.0 wait for size to be moved out of Iterable.contains - //containsSize(0, 1) + toContainInOrderOnlyDescr() + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain + //toContainsSize(0, 1) elementOutOfBound(0, "a", 1) } } @@ -114,12 +114,12 @@ abstract class MapContainsInOrderOnlyKeyValuePairsExpectationsSpec( it("$name - a to 2, b to 3, c to 4 } throws AssertionError, reports a, b and c") { expect { - expect(emptyMap).containsFun("a" to 2, arrayOf("b" to 3, "c" to 4)) + expect(emptyMap).toContainFun("a" to 2, arrayOf("b" to 3, "c" to 4)) }.toThrow { message { - containsInOrderOnlyDescr() - // TODO 0.18.0 wait for size to be moved out of Iterable.contains - //containsSize(0, 3) + toContainInOrderOnlyDescr() + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain + //toContainsSize(0, 3) elementOutOfBound(0, "a", 2) elementOutOfBound(1, "b", 3) elementOutOfBound(2, "c", 4) @@ -132,38 +132,38 @@ abstract class MapContainsInOrderOnlyKeyValuePairsExpectationsSpec( context("map $map") { val fluent = expect(map) - containsKeyValuePairsFunctions.forEach { (name, containsFun) -> + toContainKeyValuePairsFunctions.forEach { (name, toContainFun) -> listOf( listOf("a" to 1, "b" to 2) ).forEach { it("$name - ${it.joinToString()} does not throw") { - fluent.containsFun(it.first(), it.drop(1).toTypedArray()) + fluent.toContainFun(it.first(), it.drop(1).toTypedArray()) } } it("$name - a to 1 throws AssertionError, missing b") { expect { - fluent.containsFun("a" to 1, arrayOf()) + fluent.toContainFun("a" to 1, arrayOf()) }.toThrow { message { elementSuccess(0, "a=1", "a", 1) additionalEntries(1 to "b=2") - // TODO 0.18.0 wait for size to be moved out of Iterable.contains -// containsSize(2, 1) + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain +// toContainsSize(2, 1) } } } it("$name - b 2, a to 1 throws AssertionError, wrong order") { expect { - fluent.containsFun("b" to 2, arrayOf("a" to 1)) + fluent.toContainFun("b" to 2, arrayOf("a" to 1)) }.toThrow { message { elementFailing(0, "a=1", "b", 2) elementFailing(1, "b=2", "a", 1) - // TODO 0.18.0 wait for size to be moved out of Iterable.contains -// containsNot(sizeDescr) + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain +// toContainNot(sizeDescr) notToContain(additionalEntriesDescr) } } @@ -171,7 +171,7 @@ abstract class MapContainsInOrderOnlyKeyValuePairsExpectationsSpec( it("$name - a to 1, b to 1, c to 4 throws AssertionError, reports b and c") { expect { - fluent.containsFun("a" to 1, arrayOf("b" to 1, "c" to 4)) + fluent.toContainFun("a" to 1, arrayOf("b" to 1, "c" to 4)) }.toThrow { message { elementSuccess(0, "a=1", "a", 1) @@ -186,7 +186,7 @@ abstract class MapContainsInOrderOnlyKeyValuePairsExpectationsSpec( } describeFun(keyValuePairsNullable) { - val containsFun = keyValuePairsNullable.lambda + val toContainFun = keyValuePairsNullable.lambda val nullableFluent = expect(nullableMap) context("map: $nullableMap") { @@ -194,34 +194,34 @@ abstract class MapContainsInOrderOnlyKeyValuePairsExpectationsSpec( listOf("a" to null, null to 1, "b" to 2) ).forEach { it("$it does not throw") { - expect(nullableMap).containsFun(it.first(), it.drop(1).toTypedArray()) + expect(nullableMap).toContainFun(it.first(), it.drop(1).toTypedArray()) } } it("a to null throws AssertionError, missing b") { expect { - nullableFluent.containsFun("a" to null, arrayOf()) + nullableFluent.toContainFun("a" to null, arrayOf()) }.toThrow { message { elementSuccess(0, "a=null", "a", null) additionalEntries(1 to "null=1", 2 to "b=2") - // TODO 0.18.0 wait for size to be moved out of Iterable.contains -// containsSize(3, 1) + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain +// toContainsSize(3, 1) } } } it("b to 2, a to null, null to 1 throws AssertionError, wrong order") { expect { - nullableFluent.containsFun("b" to 2, arrayOf("a" to null, null to 1)) + nullableFluent.toContainFun("b" to 2, arrayOf("a" to null, null to 1)) }.toThrow { message { elementFailing(0, "a=null", "b", 2) elementFailing(1, "null=1", "a", null) elementFailing(2, "b=2", null, 1) - // TODO 0.18.0 wait for size to be moved out of Iterable.contains -// containsNot(sizeDescr) + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain +// toContainNot(sizeDescr) notToContain(additionalEntriesDescr) } @@ -231,15 +231,15 @@ abstract class MapContainsInOrderOnlyKeyValuePairsExpectationsSpec( it("a to null, c to 3, b to 3 throws AssertionError, reports b and c") { expect { - nullableFluent.containsFun("a" to null, arrayOf("c" to 3, "b" to 3)) + nullableFluent.toContainFun("a" to null, arrayOf("c" to 3, "b" to 3)) }.toThrow { message { elementSuccess(0, "a=null", "a", null) elementFailing(1, "null=1", "c", 3) elementFailing(2, "b=2", "b", 3) - // TODO 0.18.0 wait for size to be moved out of Iterable.contains -// containsNot(sizeDescr) + // TODO 0.18.0 wait for size to be moved out of Iterable.toContain +// toContainNot(sizeDescr) notToContain(additionalEntriesDescr) } }