diff --git a/README.md b/README.md index d25c67b49..db03f2ba2 100644 --- a/README.md +++ b/README.md @@ -290,7 +290,7 @@ The next section shows how you can define multiple assertions for the same subje // two single assertions, only first evaluated expect(4 + 6).toBeLessThan(5).toBeGreaterThan(10) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L25)[Output](#ex-single) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L24)[Output](#ex-single) ```text expected that subject: 10 (kotlin.Int <1234789>) @@ -327,7 +327,7 @@ expect(4 + 6) { toBeGreaterThan(10) } ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L41)[Output](#ex-group) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L40)[Output](#ex-group) ```text expected that subject: 10 (kotlin.Int <1234789>) @@ -363,7 +363,7 @@ expect { throw IllegalArgumentException("name is empty") }.toThrow() ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L65)[Output](#ex-toThrow1) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L64)[Output](#ex-toThrow1) ```text expected that subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpec$1$7$1 <1234789>) @@ -372,10 +372,10 @@ expected that subject: () -> kotlin.Nothing (readme.examples.MostExamples ℹ Properties of the unexpected IllegalArgumentException » message: "name is empty" <1234789> » stacktrace: - ⚬ readme.examples.MostExamplesSpec$1$7$1.invoke(MostExamplesSpec.kt:68) - ⚬ readme.examples.MostExamplesSpec$1$7$1.invoke(MostExamplesSpec.kt:23) - ⚬ readme.examples.MostExamplesSpec$1$7.invoke(MostExamplesSpec.kt:273) - ⚬ readme.examples.MostExamplesSpec$1$7.invoke(MostExamplesSpec.kt:23) + ⚬ readme.examples.MostExamplesSpec$1$7$1.invoke(MostExamplesSpec.kt:67) + ⚬ readme.examples.MostExamplesSpec$1$7$1.invoke(MostExamplesSpec.kt:22) + ⚬ readme.examples.MostExamplesSpec$1$7.invoke(MostExamplesSpec.kt:272) + ⚬ readme.examples.MostExamplesSpec$1$7.invoke(MostExamplesSpec.kt:22) ``` @@ -399,7 +399,7 @@ expect { throw IllegalArgumentException() }.toThrow().message.toStartWith("firstName") ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L72)[Output](#ex-toThrow2) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L71)[Output](#ex-toThrow2) ```text expected that subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpec$1$8$1 <1234789>) @@ -420,7 +420,7 @@ expect { message { toStartWith("firstName") } } ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L78)[Output](#ex-toThrow3) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L77)[Output](#ex-toThrow3) ```text expected that subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpec$1$9$1 <1234789>) @@ -444,7 +444,7 @@ expect { throw IllegalArgumentException("name is empty", RuntimeException("a cause")) }.notToThrow() ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L86)[Output](#ex-notToThrow) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L85)[Output](#ex-notToThrow) ```text expected that subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpec$1$10$1 <1234789>) @@ -452,14 +452,14 @@ expected that subject: () -> kotlin.Nothing (readme.examples.MostExamples ℹ Properties of the unexpected IllegalArgumentException » message: "name is empty" <1234789> » stacktrace: - ⚬ readme.examples.MostExamplesSpec$1$10$1.invoke(MostExamplesSpec.kt:89) - ⚬ readme.examples.MostExamplesSpec$1$10$1.invoke(MostExamplesSpec.kt:23) - ⚬ readme.examples.MostExamplesSpec$1$10.invoke(MostExamplesSpec.kt:90) - ⚬ readme.examples.MostExamplesSpec$1$10.invoke(MostExamplesSpec.kt:23) + ⚬ readme.examples.MostExamplesSpec$1$10$1.invoke(MostExamplesSpec.kt:88) + ⚬ readme.examples.MostExamplesSpec$1$10$1.invoke(MostExamplesSpec.kt:22) + ⚬ readme.examples.MostExamplesSpec$1$10.invoke(MostExamplesSpec.kt:89) + ⚬ readme.examples.MostExamplesSpec$1$10.invoke(MostExamplesSpec.kt:22) » cause: java.lang.RuntimeException » message: "a cause" <1234789> » stacktrace: - ⚬ readme.examples.MostExamplesSpec$1$10$1.invoke(MostExamplesSpec.kt:89) + ⚬ readme.examples.MostExamplesSpec$1$10$1.invoke(MostExamplesSpec.kt:88) ``` @@ -851,7 +851,7 @@ expect(x).toBeAnInstanceOf() .feature { f(it::number) } .toEqual(2) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L93)[Output](#ex-type-assertions-1) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L92)[Output](#ex-type-assertions-1) ```text expected that subject: SubType2(word=hello, flag=true) (readme.examples.SubType2 <1234789>) @@ -873,7 +873,7 @@ expect(x).toBeAnInstanceOf { feature { f(it::flag) }.toEqual(false) } ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L99)[Output](#ex-type-assertions-2) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L98)[Output](#ex-type-assertions-2) ```text expected that subject: SubType2(word=hello, flag=true) (readme.examples.SubType2 <1234789>) @@ -902,7 +902,7 @@ Let us look at the case where the subject of the assertion has a [nullable type] val slogan1: String? = "postulating assertions made easy" expect(slogan1).toEqual(null) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L107)[Output](#ex-nullable-1) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L106)[Output](#ex-nullable-1) ```text expected that subject: "postulating assertions made easy" <1234789> @@ -916,7 +916,7 @@ expected that subject: "postulating assertions made easy" <1234789> val slogan2: String? = null expect(slogan2).toEqual("postulating assertions made easy") ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L111)[Output](#ex-nullable-2) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L110)[Output](#ex-nullable-2) ```text expected that subject: null @@ -937,7 +937,7 @@ expect(slogan2) // subject has type String? .notToEqualNull() // subject is narrowed to String .toStartWith("atrium") ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L116)[Output](#ex-nullable-3) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L115)[Output](#ex-nullable-3) ```text expected that subject: null @@ -954,7 +954,7 @@ one without (example above) and one with `assertionCreator`-lambda (example belo ```kotlin expect(slogan2).notToEqualNull { toStartWith("atrium") } ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L121)[Output](#ex-nullable-4) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L120)[Output](#ex-nullable-4) ```text expected that subject: null @@ -993,7 +993,7 @@ The following sub sections show both use cases by examples. ```kotlin expect(listOf(1, 2, 2, 4)).toContain(2, 3) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L125)[Output](#ex-collection-short-1) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L124)[Output](#ex-collection-short-1) ```text expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>) @@ -1032,7 +1032,7 @@ expect(listOf(1, 2, 2, 4)).toContain( { toBeGreaterThan(2).toBeLessThan(4) } ) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L129)[Output](#ex-collection-short-2) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L128)[Output](#ex-collection-short-2) ```text expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>) @@ -1074,11 +1074,11 @@ Following each in action: ```kotlin -expect(listOf(1, 2, 3, 4)).toHaveNextAndAny { +expect(listOf(1, 2, 3, 4)).toHaveElementsAndAny { toBeLessThan(0) } ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L136)[Output](#ex-collection-any) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L135)[Output](#ex-collection-any) ```text expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>) @@ -1093,11 +1093,11 @@ expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789> ```kotlin -expect(listOf(1, 2, 3, 4)).toHaveNextAndNone { +expect(listOf(1, 2, 3, 4)).toHaveElementsAndNone { toBeGreaterThan(2) } ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L141)[Output](#ex-collection-none) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L140)[Output](#ex-collection-none) ```text expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>) @@ -1114,11 +1114,11 @@ expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789> ```kotlin -expect(listOf(1, 2, 3, 4)).toHaveNextAndAll { +expect(listOf(1, 2, 3, 4)).toHaveElementsAndAll { toBeGreaterThan(2) } ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L146)[Output](#ex-collection-all) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L145)[Output](#ex-collection-all) ```text expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>) @@ -1148,7 +1148,7 @@ Following on the last section we will start with an `inOrder` example: ```kotlin expect(listOf(1, 2, 2, 4)).toContain.inOrder.only.entries({ toBeLessThan(3) }, { toBeLessThan(2) }) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L152)[Output](#ex-collection-builder-1) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L151)[Output](#ex-collection-builder-1) ```text expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>) @@ -1196,7 +1196,7 @@ and we happily answer your question there. ```kotlin expect(listOf(1, 2, 2, 4)).toContain.inOrder.only.values(1, 2, 2, 3, 4) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L155)[Output](#ex-collection-builder-2) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L154)[Output](#ex-collection-builder-2) ```text expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>) @@ -1221,7 +1221,7 @@ expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789> ```kotlin expect(listOf(1, 2, 2, 4)).toContain.inAnyOrder.atLeast(1).butAtMost(2).entries({ toBeLessThan(3) }) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L158)[Output](#ex-collection-builder-3) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L157)[Output](#ex-collection-builder-3) ```text expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>) @@ -1238,7 +1238,7 @@ expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789> ```kotlin expect(listOf(1, 2, 2, 4)).toContain.inAnyOrder.only.values(1, 2, 3, 4) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L161)[Output](#ex-collection-builder-4) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L160)[Output](#ex-collection-builder-4) ```text expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>) @@ -1257,7 +1257,7 @@ expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789> ```kotlin expect(listOf(1, 2, 2, 4)).toContain.inAnyOrder.only.values(4, 3, 2, 2, 1) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L164)[Output](#ex-collection-builder-5) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L163)[Output](#ex-collection-builder-5) ```text expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>) @@ -1287,7 +1287,7 @@ and more [Sophisticated Assertion Builder](#sophisticated-assertion-builders-1) ```kotlin expect(mapOf("a" to 1, "b" to 2)).contains("c" to 2, "a" to 1, "b" to 1) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L168)[Output](#ex-map-1) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L167)[Output](#ex-map-1) ```text expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) @@ -1311,7 +1311,7 @@ expect(mapOf("a" to 1, "b" to 2)).contains( KeyValue("b") { toBeLessThan(2) } ) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L171)[Output](#ex-map-2) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L170)[Output](#ex-map-2) ```text expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) @@ -1333,7 +1333,7 @@ Again both overloads are provided, one for key-value `Pair`s: ```kotlin expect(mapOf("a" to 1, "b" to 2)).containsOnly("b" to 2) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L179)[Output](#ex-map-only-1) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L178)[Output](#ex-map-only-1) ```text expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) @@ -1358,7 +1358,7 @@ expect(mapOf("a" to 1, "b" to 2)).containsOnly( KeyValue("b") { toBeLessThan(2) } ) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L182)[Output](#ex-map-only-2) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L181)[Output](#ex-map-only-2) ```text expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) @@ -1386,7 +1386,7 @@ again provide two overloads, one expecting key-value `Pair`s: ```kotlin expect(mapOf("a" to 1, "b" to 2)).contains.inOrder.only.entries("b" to 2, "a" to 1) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L190)[Output](#ex-map-builder-1) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L189)[Output](#ex-map-builder-1) ```text expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) @@ -1413,7 +1413,7 @@ expect(mapOf("a" to 1, "b" to 2)).contains.inOrder.only.entries( KeyValue("a") { toBeLessThan(2) }, KeyValue("b") { toBeLessThan(2) }) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L193)[Output](#ex-map-builder-2) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L192)[Output](#ex-map-builder-2) ```text expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) @@ -1450,7 +1450,7 @@ expect(mapOf("bernstein" to bernstein)) feature { f(it::firstName) }.toEqual("Albert") } ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L203)[Output](#ex-map-3) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L202)[Output](#ex-map-3) ```text expected that subject: {bernstein=Person(firstName=Leonard, lastName=Bernstein, age=50)} (java.util.Collections.SingletonMap <1234789>) @@ -1466,11 +1466,11 @@ In case you want to make an assertion only about the keys or values of the `Map` ```kotlin expect(mapOf("a" to 1, "b" to 2)) { - keys { toHaveNextAndAll { toStartWith("a") } } - values { toHaveNextAndNone { toBeGreaterThan(1) } } + keys { toHaveElementsAndAll { toStartWith("a") } } + values { toHaveElementsAndNone { toBeGreaterThan(1) } } } ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L215)[Output](#ex-map-4) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L214)[Output](#ex-map-4) ```text expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) @@ -1508,7 +1508,7 @@ expect(linkedMapOf("a" to 1, "b" to 2)).asEntries().toContain.inOrder.only.entri } ) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L221)[Output](#ex-map-5) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L220)[Output](#ex-map-5) ```text expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) @@ -1604,7 +1604,7 @@ expect("filename?") notToContain("?") } ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L231)[Output](#ex-because-1) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L230)[Output](#ex-because-1) ```text expected that subject: "filename?" <1234789> @@ -1881,7 +1881,7 @@ expect { } }.toThrow { messageContains("no no no") } ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L244)[Output](#ex-add-info-3) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L243)[Output](#ex-add-info-3) ```text expected that subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpec$1$39$1 <1234789>) @@ -1896,14 +1896,14 @@ expected that subject: () -> kotlin.Nothing (readme.examples.MostExamples ℹ Properties of the unexpected IllegalArgumentException » message: "no no no..." <1234789> » stacktrace: - ⚬ readme.examples.MostExamplesSpec$1$39$1.invoke(MostExamplesSpec.kt:249) - ⚬ readme.examples.MostExamplesSpec$1$39$1.invoke(MostExamplesSpec.kt:23) - ⚬ readme.examples.MostExamplesSpec$1$39.invoke(MostExamplesSpec.kt:273) - ⚬ readme.examples.MostExamplesSpec$1$39.invoke(MostExamplesSpec.kt:23) + ⚬ readme.examples.MostExamplesSpec$1$39$1.invoke(MostExamplesSpec.kt:248) + ⚬ readme.examples.MostExamplesSpec$1$39$1.invoke(MostExamplesSpec.kt:22) + ⚬ readme.examples.MostExamplesSpec$1$39.invoke(MostExamplesSpec.kt:272) + ⚬ readme.examples.MostExamplesSpec$1$39.invoke(MostExamplesSpec.kt:22) » cause: java.lang.UnsupportedOperationException » message: "not supported" <1234789> » stacktrace: - ⚬ readme.examples.MostExamplesSpec$1$39$1.invoke(MostExamplesSpec.kt:247) + ⚬ readme.examples.MostExamplesSpec$1$39$1.invoke(MostExamplesSpec.kt:246) ``` @@ -1924,7 +1924,7 @@ then Atrium reminds us of the possible pitfall. For instance: ```kotlin expect(BigDecimal.TEN).isEqualIncludingScale(BigDecimal("10.0")) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L254)[Output](#ex-pitfall-1) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L253)[Output](#ex-pitfall-1) ```text expected that subject: 10 (java.math.BigDecimal <1234789>) @@ -1942,7 +1942,7 @@ For instance: ```kotlin expect(listOf(1)).get(0) {} ``` -↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L257)[Output](#ex-pitfall-2) +↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L256)[Output](#ex-pitfall-2) ```text expected that subject: [1] (java.util.Collections.SingletonList <1234789>) @@ -2191,7 +2191,7 @@ Another example: assert the person has children which are all adults (assuming 1 ```kotlin fun Expect.hasAdultChildren(): Expect = feature(Person::children) { - toHaveNextAndAll { + toHaveElementsAndAll { feature(Person::age).toBeGreaterThanOrEqualTo(18) } } @@ -2241,17 +2241,17 @@ With this, we can write things like: ```kotlin expect(Person("Susanne", "Whitley", 43, listOf(Person("Petra", "Whitley", 12, listOf())))) .children { // using the fun -> assertion group, ergo sub-assertions don't fail fast - toHaveNextAndNone { + toHaveElementsAndNone { feature { f(it::firstName) }.toStartWith("Ro") } - toHaveNextAndAll { + toHaveElementsAndAll { feature { f(it::lastName) }.toEqual("Whitley") } } // subject is still Person here .apply { // only evaluated because the previous assertion group holds children // using the val -> subsequent assertions are about children and fail fast .toHaveSize(2) - .toHaveNextAndAny { + .toHaveElementsAndAny { feature { f(it::age) }.toBeGreaterThan(18) } } // subject is still Person here due to the `apply` diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableAssertions.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableAssertions.kt index 50b9d4ea4..68b2c6f90 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableAssertions.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableAssertions.kt @@ -299,8 +299,8 @@ fun , T : Iterable> Expect.max(assertionCreator: Expect< * @return an [Expect] for the subject of `this` expectation. */ @Deprecated( - "Use toHaveNextAndAny; will be removed with 1.0.0 at the latest", - ReplaceWith("this.toHaveNextAndAny(assertionCreatorOrNull)") + "Use toHaveElementsAndAny; will be removed with 1.0.0 at the latest", + ReplaceWith("this.toHaveElementsAndAny(assertionCreatorOrNull)") ) fun > Expect.any(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = toContain.inAnyOrder.atLeast(1).entry(assertionCreatorOrNull) @@ -315,8 +315,8 @@ fun > Expect.any(assertionCreatorOrNull: (Expect * @return an [Expect] for the subject of `this` expectation. */ @Deprecated( - "Use toHaveNextAndNone; will be removed with 1.0.0 at the latest", - ReplaceWith("this.toHaveNextAndNone(assertionCreatorOrNull)") + "Use toHaveElementsAndNone; will be removed with 1.0.0 at the latest", + ReplaceWith("this.toHaveElementsAndNone(assertionCreatorOrNull)") ) fun > Expect.none(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = notToContain.entry(assertionCreatorOrNull) @@ -329,8 +329,8 @@ fun > Expect.none(assertionCreatorOrNull: (Expect(assertionCreatorOrNull)") + "Use toHaveElementsAndAll; will be removed with 1.0.0 at the latest", + ReplaceWith("this.toHaveElementsAndAll(assertionCreatorOrNull)") ) fun > Expect.all(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = _logicAppend { all(::identity, assertionCreatorOrNull) } @@ -344,8 +344,8 @@ fun > Expect.all(assertionCreatorOrNull: (Expect * @since 0.9.0 */ @Deprecated( - "Use toHaveNext; will be removed with 1.0.0 at the latest", - ReplaceWith("this.toHaveNext()") + "Use toHaveElements; will be removed with 1.0.0 at the latest", + ReplaceWith("this.toHaveElements()") ) fun > Expect.hasNext(): Expect = _logicAppend { hasNext(::identity) } @@ -358,8 +358,8 @@ fun > Expect.hasNext(): Expect = * @since 0.9.0 */ @Deprecated( - "Use notToHaveNext; will be removed with 1.0.0 at the latest", - ReplaceWith("this.notToHaveNext()") + "Use notToHaveElements; will be removed with 1.0.0 at the latest", + ReplaceWith("this.notToHaveElements()") ) fun > Expect.hasNotNext(): Expect = _logicAppend { hasNotNext(::identity) } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableExpectations.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableExpectations.kt index ae4765f75..d0ce6a43d 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableExpectations.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableExpectations.kt @@ -223,7 +223,7 @@ fun > Expect.notToContain(expected: E, vararg otherExpecte * * @since 0.17.0 */ -fun > Expect.toHaveNextAndAny(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = +fun > Expect.toHaveElementsAndAny(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = toContain.inAnyOrder.atLeast(1).entry(assertionCreatorOrNull) /** @@ -237,7 +237,7 @@ fun > Expect.toHaveNextAndAny(assertionCreatorOrNul * * @since 0.17.0 */ -fun > Expect.toHaveNextAndNone(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = +fun > Expect.toHaveElementsAndNone(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = notToContain.entry(assertionCreatorOrNull) /** @@ -249,7 +249,7 @@ fun > Expect.toHaveNextAndNone(assertionCreatorOrNu * * @since 0.17.0 */ -fun > Expect.toHaveNextAndAll(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = +fun > Expect.toHaveElementsAndAll(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = _logicAppend { all(::identity, assertionCreatorOrNull) } @@ -260,7 +260,7 @@ fun > Expect.toHaveNextAndAll(assertionCreatorOrNul * * @since 0.17.0 */ -fun > Expect.toHaveNext(): Expect = +fun > Expect.toHaveElements(): Expect = _logicAppend { hasNext(::identity) } /** @@ -270,7 +270,7 @@ fun > Expect.toHaveNext(): Expect = * * @since 0.17.0 */ -fun > Expect.notToHaveNext(): Expect = +fun > Expect.notToHaveElements(): Expect = _logicAppend { hasNotNext(::identity) } /** diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableExpectationsSpec.kt index 7f2a92e45..5b47aa8a1 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableExpectationsSpec.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableExpectationsSpec.kt @@ -4,8 +4,8 @@ import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.specs.* object IterableExpectationsSpec : ch.tutteli.atrium.specs.integration.IterableExpectationsSpec( - fun0(Expect>::toHaveNext), - fun0(Expect>::notToHaveNext), + fun0(Expect>::toHaveElements), + fun0(Expect>::notToHaveElements), feature0, Int>(Expect>::min), fun1, Expect.() -> Unit>(Expect>::min), feature0, Int>(Expect>::max), @@ -19,16 +19,16 @@ object IterableExpectationsSpec : ch.tutteli.atrium.specs.integration.IterableEx var a1b: Expect> = notImplemented() var star: Expect> = notImplemented() - a1 = a1.toHaveNext() - a1 = a1.notToHaveNext() + a1 = a1.toHaveElements() + a1 = a1.notToHaveElements() a1 = a1.notToContainDuplicates() - a1b = a1b.toHaveNext() - a1b = a1b.notToHaveNext() + a1b = a1b.toHaveElements() + a1b = a1b.notToHaveElements() a1b = a1b.notToContainDuplicates() - star = star.toHaveNext() - star = star.notToHaveNext() + star = star.toHaveElements() + star = star.notToHaveElements() star = star.notToContainDuplicates() //nullable not supported by min/max or rather T : Comparable does not exist for T? (one cannot implement an interface for the nullable type) diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveNextAndAllExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveElementsAndAllExpectationsSpec.kt similarity index 54% rename from apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveNextAndAllExpectationsSpec.kt rename to apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveElementsAndAllExpectationsSpec.kt index 7f96d9799..b10723bee 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveNextAndAllExpectationsSpec.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveElementsAndAllExpectationsSpec.kt @@ -5,9 +5,9 @@ import ch.tutteli.atrium.specs.fun1 import ch.tutteli.atrium.specs.notImplemented import ch.tutteli.atrium.specs.withNullableSuffix -object IterableToHaveNextAndAllExpectationsSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndAllExpectationsSpec( - fun1(Expect>::toHaveNextAndAll), - fun1(Expect>::toHaveNextAndAll).withNullableSuffix() +object IterableToHaveElementsAndAllExpectationsSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndAllExpectationsSpec( + fun1(Expect>::toHaveElementsAndAll), + fun1(Expect>::toHaveElementsAndAll).withNullableSuffix() ) { @@ -18,10 +18,10 @@ object IterableToHaveNextAndAllExpectationsSpec : ch.tutteli.atrium.specs.integr var subList: Expect> = notImplemented() var star: Expect> = notImplemented() - list = list.toHaveNextAndAll {} - nList = nList.toHaveNextAndAll {} - subList = subList.toHaveNextAndAll {} - star = star.toHaveNextAndAll {} + list = list.toHaveElementsAndAll {} + nList = nList.toHaveElementsAndAll {} + subList = subList.toHaveElementsAndAll {} + star = star.toHaveElementsAndAll {} } } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveNextAndAnyExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveElementsAndAnyExpectationsSpec.kt similarity index 83% rename from apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveNextAndAnyExpectationsSpec.kt rename to apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveElementsAndAnyExpectationsSpec.kt index 999f8e1d1..6078e89a2 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveNextAndAnyExpectationsSpec.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveElementsAndAnyExpectationsSpec.kt @@ -7,21 +7,21 @@ import ch.tutteli.atrium.specs.fun1 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.IterableToHaveNextAndAnyExpectationsSpec.Companion as C +import ch.tutteli.atrium.api.fluent.en_GB.IterableToHaveElementsAndAnyExpectationsSpec.Companion as C -class IterableToHaveNextAndAnyExpectationsSpec : Spek({ +class IterableToHaveElementsAndAnyExpectationsSpec : Spek({ include(PredicateSpec) include(BuilderSpec) include(ShortcutSpec) include(SequenceSpec) }) { - object PredicateSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndAnyExpectationsSpec( - fun1(Expect>::toHaveNextAndAny), - fun1(Expect>::toHaveNextAndAny).withNullableSuffix(), + object PredicateSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndAnyExpectationsSpec( + fun1(Expect>::toHaveElementsAndAny), + fun1(Expect>::toHaveElementsAndAny).withNullableSuffix(), "[Atrium][Predicate] " ) - object BuilderSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndAnyExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndAnyExpectationsSpec( functionDescription to C::toContainEntry, (functionDescription to C::toContainNullableEntry).withNullableSuffix(), "[Atrium][Builder] " @@ -29,14 +29,14 @@ class IterableToHaveNextAndAnyExpectationsSpec : Spek({ // TODO 0.19.0 #722 this will differ once we don't implement the same behaviour for toContain and none // that's fine and we can simply remove this test here - object ShortcutSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndAnyExpectationsSpec( + object ShortcutSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndAnyExpectationsSpec( shortcutDescription to C::toContainEntryShortcut, (shortcutDescription to C::toContainNullableEntryShortcut).withNullableSuffix(), "[Atrium][Shortcut] " ) // TODO move to own SequenceSpec if we really need this (maybe we can also just delete it?) - object SequenceSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndAnyExpectationsSpec( + object SequenceSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndAnyExpectationsSpec( getToContainSequencePair(), getToContainNullableSequencePair().withNullableSuffix(), "[Atrium][Sequence] " @@ -87,9 +87,9 @@ class IterableToHaveNextAndAnyExpectationsSpec : Spek({ var subList: Expect> = notImplemented() var star: Expect> = notImplemented() - list = list.toHaveNextAndAny {} - nList = nList.toHaveNextAndAny {} - subList = subList.toHaveNextAndAny {} - star = star.toHaveNextAndAny {} + list = list.toHaveElementsAndAny {} + nList = nList.toHaveElementsAndAny {} + subList = subList.toHaveElementsAndAny {} + star = star.toHaveElementsAndAny {} } } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveNextAndNoneExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveElementsAndNoneExpectationsSpec.kt similarity index 72% rename from apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveNextAndNoneExpectationsSpec.kt rename to apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveElementsAndNoneExpectationsSpec.kt index a7a3350fc..57be728ff 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveNextAndNoneExpectationsSpec.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToHaveElementsAndNoneExpectationsSpec.kt @@ -5,21 +5,21 @@ import ch.tutteli.atrium.specs.fun1 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.IterableToHaveNextAndNoneExpectationsSpec.Companion as C +import ch.tutteli.atrium.api.fluent.en_GB.IterableToHaveElementsAndNoneExpectationsSpec.Companion as C -class IterableToHaveNextAndNoneExpectationsSpec : Spek({ +class IterableToHaveElementsAndNoneExpectationsSpec : Spek({ include(PredicateSpec) include(BuilderSpec) }) { - object PredicateSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndNoneExpectationsSpec( - fun1(Expect>::toHaveNextAndNone), - fun1(Expect>::toHaveNextAndNone).withNullableSuffix(), + object PredicateSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndNoneExpectationsSpec( + fun1(Expect>::toHaveElementsAndNone), + fun1(Expect>::toHaveElementsAndNone).withNullableSuffix(), "[Atrium][Predicate] " ) // TODO 0.19.0 #722 this will differ once we don't implement the same behaviour for contains and none // that's fine and we can simply remove this test here - object BuilderSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndNoneExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndNoneExpectationsSpec( functionDescription to C::notToContainFun, (functionDescription to C::notToContainNullableFun).withNullableSuffix(), "[Atrium][Builder] " @@ -42,9 +42,9 @@ class IterableToHaveNextAndNoneExpectationsSpec : Spek({ var subList: Expect> = notImplemented() var star: Expect> = notImplemented() - list = list.toHaveNextAndNone {} - nList = nList.toHaveNextAndNone {} - subList = subList.toHaveNextAndNone {} - star = star.toHaveNextAndNone {} + list = list.toHaveElementsAndNone {} + nList = nList.toHaveElementsAndNone {} + subList = subList.toHaveElementsAndNone {} + star = star.toHaveElementsAndNone {} } } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/AnyExpectationSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/AnyExpectationSamples.kt index a786f4db4..9e8c5125d 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/AnyExpectationSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/AnyExpectationSamples.kt @@ -2,7 +2,6 @@ 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 ch.tutteli.atrium.creating.Expect import kotlin.test.Test class AnyExpectationSamples { @@ -211,7 +210,7 @@ class AnyExpectationSamples { notToContain("?") } - expect(customers).toHaveNextAndAll { + expect(customers).toHaveElementsAndAll { because("the legal age of maturity in Switzerland is 18") { feature { f(it::age) }.toBeGreaterThanOrEqualTo(18) } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/AnyAssertionSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/AnyAssertionSamples.kt index df89fd2b2..cc1a443bb 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/AnyAssertionSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/AnyAssertionSamples.kt @@ -6,7 +6,6 @@ package ch.tutteli.atrium.api.fluent.en_GB.samples.deprecated import ch.tutteli.atrium.api.fluent.en_GB.* import ch.tutteli.atrium.api.fluent.en_GB.samples.fails import ch.tutteli.atrium.api.verbs.internal.expect -import ch.tutteli.atrium.creating.Expect import kotlin.test.Test class AnyAssertionSamples { @@ -217,7 +216,7 @@ class AnyAssertionSamples { containsNot("?") } - expect(customers).toHaveNextAndAll { + expect(customers).toHaveElementsAndAll { because("the legal age of maturity in Switzerland is 18") { feature { f(it::age) }.isGreaterThanOrEqual(18) } diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/iterableAssertions.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/iterableAssertions.kt index 7ade54061..6bb36305a 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/iterableAssertions.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/iterableAssertions.kt @@ -345,8 +345,8 @@ infix fun , T : Iterable> Expect.max(assertionCreator: E * @return an [Expect] for the subject of `this` expectation. */ @Deprecated( - "Use toHaveNextAndAny; will be removed with 1.0.0 at the latest", - ReplaceWith("this.toHaveNextAndAny(assertionCreatorOrNull)") + "Use toHaveElementsAndAny; will be removed with 1.0.0 at the latest", + ReplaceWith("this.toHaveElementsAndAny(assertionCreatorOrNull)") ) infix fun > Expect.any(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = it toContain o inAny order atLeast 1 entry assertionCreatorOrNull @@ -362,8 +362,8 @@ infix fun > Expect.any(assertionCreatorOrNull: (Exp * @return an [Expect] for the subject of `this` expectation. */ @Deprecated( - "Use toHaveNextAndNone; will be removed with 1.0.0 at the latest", - ReplaceWith("this.toHaveNextAndNone(assertionCreatorOrNull)") + "Use toHaveElementsAndNone; will be removed with 1.0.0 at the latest", + ReplaceWith("this.toHaveElementsAndNone(assertionCreatorOrNull)") ) infix fun > Expect.none(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = it notToContain o entry assertionCreatorOrNull @@ -376,8 +376,8 @@ infix fun > Expect.none(assertionCreatorOrNull: (Ex * @return an [Expect] for the subject of `this` expectation. */ @Deprecated( - "Use toHaveNextAndAll; will be removed with 1.0.0 at the latest", - ReplaceWith("this.toHaveNextAndAll(assertionCreatorOrNull)") + "Use toHaveElementsAndAll; will be removed with 1.0.0 at the latest", + ReplaceWith("this.toHaveElementsAndAll(assertionCreatorOrNull)") ) infix fun > Expect.all(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = _logicAppend { all(::identity, assertionCreatorOrNull) } @@ -392,7 +392,7 @@ infix fun > Expect.all(assertionCreatorOrNull: (Exp */ @Deprecated( "Use toHaveNext; will be removed with 1.0.0 at the latest", - ReplaceWith("this.toHaveNext()") + ReplaceWith("this.toHaveNext(elements)", "ch.tutteli.atrium.api.infix.en_GB.elements") ) infix fun > Expect.has(@Suppress("UNUSED_PARAMETER") next: next): Expect = _logicAppend { hasNext(::identity) } @@ -406,7 +406,7 @@ infix fun > Expect.has(@Suppress("UNUSED_PARAMETER") next: */ @Deprecated( "Use notToHaveNext; will be removed with 1.0.0 at the latest", - ReplaceWith("this.notToHaveNext()") + ReplaceWith("this.notToHaveNext(elements)", "ch.tutteli.atrium.api.infix.en_GB.elements") ) infix fun > Expect.hasNot(@Suppress("UNUSED_PARAMETER") next: next): Expect = _logicAppend { hasNotNext(::identity) } diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/iterableExpectations.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/iterableExpectations.kt index cb911ec78..f06da8966 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/iterableExpectations.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/iterableExpectations.kt @@ -271,7 +271,7 @@ infix fun > Expect.notToContain(values: Values): Expect * * @since 0.17.0 */ -infix fun > Expect.toHaveNextAndAny(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = +infix fun > Expect.toHaveElementsAndAny(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = it toContain o inAny order atLeast 1 entry assertionCreatorOrNull @@ -286,7 +286,7 @@ infix fun > Expect.toHaveNextAndAny(assertionCreato * * @since 0.17.0 */ -infix fun > Expect.toHaveNextAndNone(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = +infix fun > Expect.toHaveElementsAndNone(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = it notToContain o entry assertionCreatorOrNull /** @@ -298,7 +298,7 @@ infix fun > Expect.toHaveNextAndNone(assertionCreat * * @since 0.17.0 */ -infix fun > Expect.toHaveNextAndAll(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = +infix fun > Expect.toHaveElementsAndAll(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect = _logicAppend { all(::identity, assertionCreatorOrNull) } @@ -309,7 +309,7 @@ infix fun > Expect.toHaveNextAndAll(assertionCreato * * @since 0.17.0 */ -infix fun > Expect.toHave(@Suppress("UNUSED_PARAMETER") next: next): Expect = +infix fun > Expect.toHave(@Suppress("UNUSED_PARAMETER") elements: elements): Expect = _logicAppend { hasNext(::identity) } /** @@ -319,7 +319,7 @@ infix fun > Expect.toHave(@Suppress("UNUSED_PARAMETER") ne * * @since 0.17.0 */ -infix fun > Expect.notToHave(@Suppress("UNUSED_PARAMETER") next: next): Expect = +infix fun > Expect.notToHave(@Suppress("UNUSED_PARAMETER") elements: elements): Expect = _logicAppend { hasNotNext(::identity) } /** diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/keywords.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/keywords.kt index c27a08f82..3d9b93d11 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/keywords.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/keywords.kt @@ -166,3 +166,11 @@ object noDuplicates : Keyword * @since 0.17.0 */ object duplicates : Keyword + +/** + * A helper construct to allow expressing expectations about elements as in `expect(iterable) toHave elements`. + * It can be used for a parameterless function so that it has one parameter and thus can be used as infix function. + * + * @since 0.17.0 + */ +object elements: Keyword diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableExpectationsSpec.kt index 63cff5215..a41736af6 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableExpectationsSpec.kt @@ -5,8 +5,8 @@ import ch.tutteli.atrium.specs.* import kotlin.reflect.KFunction2 class IterableExpectationsSpec : ch.tutteli.atrium.specs.integration.IterableExpectationsSpec( - getToHaveNextPair(), - getNotToHaveNextPair(), + getToHaveElementsPair(), + getNotToHaveElementstPair(), minFeaturePair(), fun1, Expect.() -> Unit>(Expect>::min), maxFeaturePair(), @@ -14,15 +14,15 @@ class IterableExpectationsSpec : ch.tutteli.atrium.specs.integration.IterableExp getToContainNoDuplicatesPair() ) { companion object { - private val toHave: KFunction2>, next, Expect>> = Expect>::toHave - private fun getToHaveNextPair() = "${toHave.name} ${next::class.simpleName}" to Companion::toHaveNext - private fun toHaveNext(expect: Expect>) = expect toHave next + private val toHave: KFunction2>, elements, Expect>> = Expect>::toHave + private fun getToHaveElementsPair() = "${toHave.name} ${next::class.simpleName}" to Companion::toHaveElements + private fun toHaveElements(expect: Expect>) = expect toHave elements - private val notToHave: KFunction2>, next, Expect>> = + private val notToHave: KFunction2>, elements, Expect>> = Expect>::notToHave - private fun getNotToHaveNextPair() = "${notToHave.name} ${next::class.simpleName}" to Companion::notToHaveNext - private fun notToHaveNext(expect: Expect>) = expect notToHave next + private fun getNotToHaveElementstPair() = "${notToHave.name} ${next::class.simpleName}" to Companion::notToHaveElements + private fun notToHaveElements(expect: Expect>) = expect notToHave elements private fun minFeaturePair() = feature1, o, Int>(Expect>::min).name to ::minFeature private fun minFeature(expect: Expect>) = expect min o @@ -46,16 +46,16 @@ class IterableExpectationsSpec : ch.tutteli.atrium.specs.integration.IterableExp var a1b: Expect> = notImplemented() var star: Expect> = notImplemented() - a1 = a1 toHave next - a1 = a1 notToHave next + a1 = a1 toHave elements + a1 = a1 notToHave elements a1 = a1 notToContain duplicates - a1b = a1b toHave next - a1b = a1b notToHave next + a1b = a1b toHave elements + a1b = a1b notToHave elements a1b = a1b notToContain duplicates - star = star toHave next - star = star notToHave next + star = star toHave elements + star = star notToHave elements star = star notToContain duplicates //nullable not supported by min/max or rather T : Comparable does not exist for T? (one cannot implement an interface for the nullable type) diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveNextAndAllExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveElementsAndAllExpectationsSpec.kt similarity index 51% rename from apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveNextAndAllExpectationsSpec.kt rename to apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveElementsAndAllExpectationsSpec.kt index ab6c9e289..1a873864f 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveNextAndAllExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveElementsAndAllExpectationsSpec.kt @@ -5,9 +5,9 @@ import ch.tutteli.atrium.specs.fun1 import ch.tutteli.atrium.specs.notImplemented import ch.tutteli.atrium.specs.withNullableSuffix -class IterableToHaveNextAndAllExpectationsSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndAllExpectationsSpec( - fun1(Expect>::toHaveNextAndAll), - fun1(Expect>::toHaveNextAndAll).withNullableSuffix() +class IterableToHaveElementsAndAllExpectationsSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndAllExpectationsSpec( + fun1(Expect>::toHaveElementsAndAll), + fun1(Expect>::toHaveElementsAndAll).withNullableSuffix() ) { @Suppress("unused", "UNUSED_VALUE") @@ -17,11 +17,11 @@ class IterableToHaveNextAndAllExpectationsSpec : ch.tutteli.atrium.specs.integra var star: Expect> = notImplemented() - a1 = a1 toHaveNextAndAll {} + a1 = a1 toHaveElementsAndAll {} - a1b = a1b toHaveNextAndAll {} - a1b = a1b toHaveNextAndAll null + a1b = a1b toHaveElementsAndAll {} + a1b = a1b toHaveElementsAndAll null - star = star toHaveNextAndAll {} + star = star toHaveElementsAndAll {} } } diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveNextAndAnyExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveNextAndAnyExpectationsSpec.kt index 8f124ca1f..861a05356 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveNextAndAnyExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveNextAndAnyExpectationsSpec.kt @@ -9,31 +9,31 @@ import ch.tutteli.atrium.specs.withNullableSuffix import org.spekframework.spek2.Spek import kotlin.reflect.KFunction2 -class IterableAnyExpectationsSpec : Spek({ +class IterableToHaveElementsAndAnyExpectationsSpec : Spek({ include(PredicateSpec) include(BuilderSpec) include(ShortcutSpec) include(SequenceSpec) }) { - object PredicateSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndAnyExpectationsSpec( - fun1(Expect>::toHaveNextAndAny), - fun1(Expect>::toHaveNextAndAny).withNullableSuffix(), + object PredicateSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndAnyExpectationsSpec( + fun1(Expect>::toHaveElementsAndAny), + fun1(Expect>::toHaveElementsAndAny).withNullableSuffix(), "[Atrium][Predicate] " ) - object BuilderSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndAnyExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndAnyExpectationsSpec( getToContainPair(), getToContainNullablePair().withNullableSuffix(), "[Atrium][Builder] " ) - object ShortcutSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndAnyExpectationsSpec( + object ShortcutSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndAnyExpectationsSpec( getToContainShortcutPair(), getToContainNullableShortcutPair().withNullableSuffix(), "[Atrium][Shortcut] " ) - object SequenceSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndAnyExpectationsSpec( + object SequenceSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndAnyExpectationsSpec( getToContainSequencePair(), getToContainNullableSequencePair().withNullableSuffix(), "[Atrium][Sequence] " @@ -94,15 +94,15 @@ class IterableAnyExpectationsSpec : Spek({ var star: Expect> = notImplemented() - a1 = a1 toHaveNextAndAny {} + a1 = a1 toHaveElementsAndAny {} a1 = a1 toContain {} - a1b = a1b toHaveNextAndAny {} - a1b = a1b toHaveNextAndAny null + a1b = a1b toHaveElementsAndAny {} + a1b = a1b toHaveElementsAndAny null a1b = a1b toContain {} a1b = a1b toContain (null as Double?) - star = star toHaveNextAndAny {} + star = star toHaveElementsAndAny {} star = star toContain {} } } diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveNextAndNoneExpectationsSpec.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveNextAndNoneExpectationsSpec.kt index 999f2cf39..b649c111a 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveNextAndNoneExpectationsSpec.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/IterableToHaveNextAndNoneExpectationsSpec.kt @@ -12,13 +12,13 @@ class IterableToHaveNextAndNoneExpectationsSpec : Spek({ include(BuilderSpec) }) { - object PredicateSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndNoneExpectationsSpec( - fun1(Expect>::toHaveNextAndNone), - fun1(Expect>::toHaveNextAndNone).withNullableSuffix(), + object PredicateSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndNoneExpectationsSpec( + fun1(Expect>::toHaveElementsAndNone), + fun1(Expect>::toHaveElementsAndNone).withNullableSuffix(), "[Atrium][Predicate] " ) - object BuilderSpec : ch.tutteli.atrium.specs.integration.IterableToHaveNextAndNoneExpectationsSpec( + object BuilderSpec : ch.tutteli.atrium.specs.integration.IterableToHaveElementsAndNoneExpectationsSpec( getNotToContainPair(), getNotToContainNullablePair().withNullableSuffix(), "[Atrium][Builder] " @@ -44,15 +44,15 @@ class IterableToHaveNextAndNoneExpectationsSpec : Spek({ var star: Expect> = notImplemented() - a1 = a1.toHaveNextAndNone {} + a1 = a1.toHaveElementsAndNone {} a1 = a1 notToContain o entry {} - a1b = a1b toHaveNextAndNone {} - a1b = a1b toHaveNextAndNone null + a1b = a1b toHaveElementsAndNone {} + a1b = a1b toHaveElementsAndNone null a1b = a1b notToContain o entry {} a1b = a1b notToContain o entry null - star = star.toHaveNextAndNone {} + star = star.toHaveElementsAndNone {} star = star notToContain o entry {} } } diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/AnyExpectationSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/AnyExpectationSamples.kt index 9834dbc7b..659341bba 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/AnyExpectationSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/AnyExpectationSamples.kt @@ -203,7 +203,7 @@ class AnyExpectationSamples { it notToContain "?" } - expect(customers) toHaveNextAndAll (fun Expect.() { + expect(customers) toHaveElementsAndAll (fun Expect.() { it because of("the legal age of maturity in Switzerland is 18") { feature { f(it::age) } toBeGreaterThanOrEqualTo 18 } diff --git a/core/atrium-core-js/src/test/kotlin/ch/tutteli/atrium/core/polyfills/ThrowableStackTest.kt b/core/atrium-core-js/src/test/kotlin/ch/tutteli/atrium/core/polyfills/ThrowableStackTest.kt index 569ffe2a4..0dc6f12db 100644 --- a/core/atrium-core-js/src/test/kotlin/ch/tutteli/atrium/core/polyfills/ThrowableStackTest.kt +++ b/core/atrium-core-js/src/test/kotlin/ch/tutteli/atrium/core/polyfills/ThrowableStackTest.kt @@ -2,7 +2,6 @@ package ch.tutteli.atrium.core.polyfills import ch.tutteli.atrium.api.infix.en_GB.* import ch.tutteli.atrium.api.verbs.internal.expect -import ch.tutteli.atrium.creating.Expect import kotlin.test.Test class ThrowableStackTest { @@ -12,10 +11,10 @@ class ThrowableStackTest { val stack = IllegalStateException("test").stackBacktrace expect(stack.first()) toStartWith "${ThrowableStackTest::class.simpleName}.illegalStateException" expect(stack) { - toHaveNextAndNone { + toHaveElementsAndNone { this toContain "init" } - toHaveNextAndAny { + toHaveElementsAndAny { this toContain "mocha" } } @@ -26,10 +25,10 @@ class ThrowableStackTest { val stack = AssertionError("test").stackBacktrace expect(stack.first()) toStartWith "${ThrowableStackTest::class.simpleName}.assertionError" expect(stack) { - toHaveNextAndNone { + toHaveElementsAndNone { this toContain "init" } - toHaveNextAndAny { + toHaveElementsAndAny { this toContain "mocha" } } diff --git a/core/atrium-core-jvm/src/test/kotlin/ch/tutteli/atrium/reporting/erroradjusters/AdjustStackSpec.kt b/core/atrium-core-jvm/src/test/kotlin/ch/tutteli/atrium/reporting/erroradjusters/AdjustStackSpec.kt index da4e63615..76d2c24c0 100644 --- a/core/atrium-core-jvm/src/test/kotlin/ch/tutteli/atrium/reporting/erroradjusters/AdjustStackSpec.kt +++ b/core/atrium-core-jvm/src/test/kotlin/ch/tutteli/atrium/reporting/erroradjusters/AdjustStackSpec.kt @@ -101,7 +101,7 @@ class AdjustStackSpec : Spek({ throwable.addSuppressed(throwable2) val adjuster = createExpect(1, factory)._logic.components.build() adjuster.adjust(throwable) - (expect(throwable.suppressed) asList o).toHaveNextAndAll(fun Expect.() { + (expect(throwable.suppressed) asList o).toHaveElementsAndAll(fun Expect.() { feature { f(it::stackBacktrace) } and { it notToContain o the entries(containsNotFirst, *containsNotRest) it toContain entries(containsFirst, *containsRest) @@ -117,7 +117,7 @@ class AdjustStackSpec : Spek({ throwable.addSuppressed(throwable2) val adjuster = createExpect(1, factory)._logic.components.build() adjuster.adjust(throwable) - (expect(throwable.suppressed) asList o).toHaveNextAndAll(fun Expect.() { + (expect(throwable.suppressed) asList o).toHaveElementsAndAll(fun Expect.() { cause { feature { f(it::stackBacktrace) } and { it notToContain o the entries(containsNotFirst, *containsNotRest) @@ -191,7 +191,7 @@ class AdjustStackSpec : Spek({ throwable.addSuppressed(throwable2) val adjuster = createExpect(1, factory)._logic.components.build() adjuster.adjust(throwable) - (expect(throwable.suppressed) asList o).toHaveNextAndAll(fun Expect.() { + (expect(throwable.suppressed) asList o).toHaveElementsAndAll(fun Expect.() { it feature { f(it::stackBacktrace) } toBe empty }) } diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt index e3f030538..baa9d022d 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt @@ -2,7 +2,7 @@ package ch.tutteli.atrium.specs import ch.tutteli.atrium.api.fluent.en_GB.feature import ch.tutteli.atrium.api.fluent.en_GB.toEqual -import ch.tutteli.atrium.api.fluent.en_GB.toHaveNextAndAll +import ch.tutteli.atrium.api.fluent.en_GB.toHaveElementsAndAll import ch.tutteli.atrium.api.verbs.internal.expect import ch.tutteli.atrium.assertions.Assertion import ch.tutteli.atrium.assertions.AssertionGroup @@ -63,7 +63,7 @@ abstract class SubjectLessSpec( val assertions = CollectingExpect(None, expect(1)._logic.components) .addAssertionsCreatedBy(createAssertion) .getAssertions() - expect(assertions).toHaveNextAndAll { + expect(assertions).toHaveElementsAndAll { feature(Assertion::holds).toEqual(false) } } diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveNextAndAllExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveElementsAndAllExpectationsSpec.kt similarity index 69% rename from misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveNextAndAllExpectationsSpec.kt rename to misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveElementsAndAllExpectationsSpec.kt index 91db84d11..7071ddf72 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveNextAndAllExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveElementsAndAllExpectationsSpec.kt @@ -7,29 +7,29 @@ import ch.tutteli.atrium.logic.utils.expectLambda import ch.tutteli.atrium.specs.* import ch.tutteli.atrium.translations.DescriptionIterableAssertion -abstract class IterableToHaveNextAndAllExpectationsSpec( - notToBeEmptyAndAll: Fun1, Expect.() -> Unit>, - notToBeEmptyAndAllNullable: Fun1, (Expect.() -> Unit)?>, +abstract class IterableToHaveElementsAndAllExpectationsSpec( + toHaveElementsAndAll: Fun1, Expect.() -> Unit>, + toHaveElementsAndAllNullable: Fun1, (Expect.() -> Unit)?>, describePrefix: String = "[Atrium] " ) : IterableToContainEntriesSpecBase({ include(object : SubjectLessSpec>(describePrefix, - notToBeEmptyAndAll.first to expectLambda { notToBeEmptyAndAll.second(this) { toEqual(2.5) } } + toHaveElementsAndAll.first to expectLambda { toHaveElementsAndAll.second(this) { toEqual(2.5) } } ) {}) include(object : SubjectLessSpec>(describePrefix, - "${notToBeEmptyAndAllNullable.first} for nullable" to expectLambda { notToBeEmptyAndAllNullable.second(this, null) } + "${toHaveElementsAndAllNullable.first} for nullable" to expectLambda { toHaveElementsAndAllNullable.second(this, null) } ) {}) include(object : AssertionCreatorSpec>( describePrefix, oneToSeven().toList().asIterable(), - notToBeEmptyAndAll.forAssertionCreatorSpec("$toBeGreaterThanDescr: 0.0") { toBeGreaterThan(0.0) } + toHaveElementsAndAll.forAssertionCreatorSpec("$toBeGreaterThanDescr: 0.0") { toBeGreaterThan(0.0) } ) {}) include(object : AssertionCreatorSpec>( "$describePrefix[nullable Element] ", oneToSeven().toList().asIterable(), - notToBeEmptyAndAllNullable.forAssertionCreatorSpec("$toBeGreaterThanDescr: 0.0") { toBeGreaterThan(0.0) } + toHaveElementsAndAllNullable.forAssertionCreatorSpec("$toBeGreaterThanDescr: 0.0") { toBeGreaterThan(0.0) } ) {}) - val notToBeEmptyAndAllDescr = DescriptionIterableAssertion.ALL.getDefault() + val toHaveElementsAndAllDescr = DescriptionIterableAssertion.ALL.getDefault() val hasElement = DescriptionIterableAssertion.HAS_ELEMENT.getDefault() val explanatoryPointWithIndent = "$indentRootBulletPoint$indentListBulletPoint$explanatoryBulletPoint" @@ -38,14 +38,14 @@ abstract class IterableToHaveNextAndAllExpectationsSpec( nonNullableCases( describePrefix, - notToBeEmptyAndAll, - notToBeEmptyAndAllNullable - ) { notToBeEmptyAndAllFun -> + toHaveElementsAndAll, + toHaveElementsAndAllNullable + ) { toHaveElementsAndAllFun -> context("empty collection") { it("throws AssertionError as there needs to be at least one element") { expect { - expect(fluentEmpty()).notToBeEmptyAndAllFun { toBeLessThan(1.0) } + expect(fluentEmpty()).toHaveElementsAndAllFun { toBeLessThan(1.0) } }.toThrow { messageContains( "$rootBulletPoint$featureArrow$hasElement: false$separator" + @@ -59,11 +59,11 @@ abstract class IterableToHaveNextAndAllExpectationsSpec( context("all are $toBeGreaterThanFun(2.5) and $toBeLessThanFun(7.0)") { it("throws AssertionError containing both assumptions in one assertion") { expect { - expect(oneToSeven()).notToBeEmptyAndAllFun { toBeGreaterThan(2.5); toBeLessThan(7.0) } + expect(oneToSeven()).toHaveElementsAndAllFun { toBeGreaterThan(2.5); toBeLessThan(7.0) } }.toThrow { message { toContain.exactly(1).values( - "$rootBulletPoint$notToBeEmptyAndAllDescr: $separator", + "$rootBulletPoint$toHaveElementsAndAllDescr: $separator", "$explanatoryPointWithIndent$toBeGreaterThanDescr: 2.5", "$explanatoryPointWithIndent$toBeLessThanDescr: 7.0", "$warningBulletPoint$mismatches:", @@ -78,7 +78,7 @@ abstract class IterableToHaveNextAndAllExpectationsSpec( context("all are $toBeGreaterThanFun(0.5) and $toBeLessThanFun(7.5)") { it("does not throw an exception") { - expect(oneToSeven()).notToBeEmptyAndAllFun { toBeGreaterThan(0.5); toBeLessThan(7.5) } + expect(oneToSeven()).toHaveElementsAndAllFun { toBeGreaterThan(0.5); toBeLessThan(7.5) } } } } @@ -86,24 +86,24 @@ abstract class IterableToHaveNextAndAllExpectationsSpec( nullableCases(describePrefix) { - describeFun(notToBeEmptyAndAllNullable) { - val notToBeEmptyAndAllNullableFun = notToBeEmptyAndAllNullable.lambda + describeFun(toHaveElementsAndAllNullable) { + val toHaveElementsAndAllNullableFun = toHaveElementsAndAllNullable.lambda val iterableOfNulls = { sequenceOf(null, null).constrainOnce().asIterable() } context("iterable ${iterableOfNulls()}") { it("all are `null` does not throw") { - expect(iterableOfNulls()).notToBeEmptyAndAllNullableFun(null) + expect(iterableOfNulls()).toHaveElementsAndAllNullableFun(null) } } context("iterable ${oneToSevenNullable().toList()}") { it("$toBeGreaterThanDescr(0.5) throws because two are `null`") { expect { - expect(oneToSevenNullable()).notToBeEmptyAndAllNullableFun { toBeGreaterThan(0.5) } + expect(oneToSevenNullable()).toHaveElementsAndAllNullableFun { toBeGreaterThan(0.5) } }.toThrow { message { toContain.exactly(1).values( - "$rootBulletPoint$notToBeEmptyAndAllDescr: $separator", + "$rootBulletPoint$toHaveElementsAndAllDescr: $separator", "$explanatoryPointWithIndent$toBeGreaterThanDescr: 0.5", "$warningBulletPoint$mismatches:", "${index(1)}: null", diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveNextAndAnyExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveElementsAndAnyExpectationsSpec.kt similarity index 75% rename from misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveNextAndAnyExpectationsSpec.kt rename to misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveElementsAndAnyExpectationsSpec.kt index 21b2ec038..93cbc4d12 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveNextAndAnyExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveElementsAndAnyExpectationsSpec.kt @@ -6,41 +6,41 @@ import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.specs.* import ch.tutteli.atrium.translations.DescriptionComparableAssertion -abstract class IterableToHaveNextAndAnyExpectationsSpec( - notToBeEmptyAndAny: Fun1, Expect.() -> Unit>, - notToBeEmptyAndAnyNullable: Fun1, (Expect.() -> Unit)?>, +abstract class IterableToHaveElementsAndAnyExpectationsSpec( + toHaveElementsAndAny: Fun1, Expect.() -> Unit>, + toHaveElementsAndAnyNullable: Fun1, (Expect.() -> Unit)?>, describePrefix: String = "[Atrium] " ) : IterableToContainEntriesSpecBase({ val isGreaterThanDescr = DescriptionComparableAssertion.IS_GREATER_THAN.getDefault() include(object : SubjectLessSpec>(describePrefix, - notToBeEmptyAndAny.forSubjectLess { toEqual(2.5) } + toHaveElementsAndAny.forSubjectLess { toEqual(2.5) } ) {}) include(object : SubjectLessSpec>( describePrefix, - notToBeEmptyAndAnyNullable.forSubjectLess(null) + toHaveElementsAndAnyNullable.forSubjectLess(null) ) {}) include(object : AssertionCreatorSpec>( describePrefix, oneToSeven().toList().asIterable(), - notToBeEmptyAndAny.forAssertionCreatorSpec("$isGreaterThanDescr: 1.0") { toBeGreaterThan(1.0) } + toHaveElementsAndAny.forAssertionCreatorSpec("$isGreaterThanDescr: 1.0") { toBeGreaterThan(1.0) } ) {}) include(object : AssertionCreatorSpec>( "$describePrefix[nullable Element] ", oneToSeven().toList().asIterable(), - notToBeEmptyAndAnyNullable.forAssertionCreatorSpec("$isGreaterThanDescr: 1.0") { toBeGreaterThan(1.0) } + toHaveElementsAndAnyNullable.forAssertionCreatorSpec("$isGreaterThanDescr: 1.0") { toBeGreaterThan(1.0) } ) {}) nonNullableCases( describePrefix, - notToBeEmptyAndAny, - notToBeEmptyAndAnyNullable - ) { notToBeEmptyAndAnyFun -> + toHaveElementsAndAny, + toHaveElementsAndAnyNullable + ) { toHaveElementsAndAnyFun -> context("empty collection") { it("throws AssertionError as there needs to be at least one element") { expect { - expect(fluentEmpty()).notToBeEmptyAndAnyFun { toBeLessThan(1.0) } + expect(fluentEmpty()).toHaveElementsAndAnyFun { toBeLessThan(1.0) } }.toThrow { messageContains( "$rootBulletPoint$toContainInAnyOrder: $separator", @@ -58,7 +58,7 @@ abstract class IterableToHaveNextAndAnyExpectationsSpec( context("search for entry which $toBeGreaterThanFun(1.0) and $toBeLessThanFun(2.0)") { it("throws AssertionError containing both assumptions in one assertion") { expect { - expect(oneToSeven()).notToBeEmptyAndAnyFun { toBeGreaterThan(1.0); toBeLessThan(2.0) } + expect(oneToSeven()).toHaveElementsAndAnyFun { toBeGreaterThan(1.0); toBeLessThan(2.0) } }.toThrow { messageContains( "$rootBulletPoint$toContainInAnyOrder: $separator", @@ -74,7 +74,7 @@ abstract class IterableToHaveNextAndAnyExpectationsSpec( context("search for entry which $toBeGreaterThanFun(1.0) and $toBeLessThanFun(2.1)") { it("does not throw an exception") { - expect(oneToSeven()).notToBeEmptyAndAnyFun { toBeGreaterThan(1.0); toBeLessThan(2.1) } + expect(oneToSeven()).toHaveElementsAndAnyFun { toBeGreaterThan(1.0); toBeLessThan(2.1) } } } } @@ -82,23 +82,23 @@ abstract class IterableToHaveNextAndAnyExpectationsSpec( nullableCases(describePrefix) { - describeFun(notToBeEmptyAndAnyNullable) { - val notToBeEmptyAndAnyFun = notToBeEmptyAndAnyNullable.lambda + describeFun(toHaveElementsAndAnyNullable) { + val toHaveElementsAndAnyFun = toHaveElementsAndAnyNullable.lambda context("iterable ${oneToSevenNullable().toList()}") { context("happy cases (do not throw)") { it("$toEqualFun(1.0)") { - expect(oneToSevenNullable()).notToBeEmptyAndAnyFun { toEqual(1.0) } + expect(oneToSevenNullable()).toHaveElementsAndAnyFun { toEqual(1.0) } } it("null") { - expect(oneToSevenNullable()).notToBeEmptyAndAnyFun(null) + expect(oneToSevenNullable()).toHaveElementsAndAnyFun(null) } } context("failing cases") { it("$toEqualFun(2.0)") { expect { - expect(oneToSevenNullable()).notToBeEmptyAndAnyFun { toEqual(2.0) } + expect(oneToSevenNullable()).toHaveElementsAndAnyFun { toEqual(2.0) } }.toThrow { message { toContain.exactly(1).values( @@ -117,7 +117,7 @@ abstract class IterableToHaveNextAndAnyExpectationsSpec( context("iterable ${oneToSeven().toList()}") { it("null, throws an AssertionError") { expect { - expect(oneToSeven() as Iterable).notToBeEmptyAndAnyFun(null) + expect(oneToSeven() as Iterable).toHaveElementsAndAnyFun(null) }.toThrow { message { toContain.exactly(1).values( diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveNextAndNoneExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveElementsAndNoneExpectationsSpec.kt similarity index 77% rename from misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveNextAndNoneExpectationsSpec.kt rename to misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveElementsAndNoneExpectationsSpec.kt index 319128bce..8e7d12809 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveNextAndNoneExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/IterableToHaveElementsAndNoneExpectationsSpec.kt @@ -6,26 +6,26 @@ import ch.tutteli.atrium.creating.Expect import ch.tutteli.atrium.specs.* import ch.tutteli.atrium.translations.DescriptionIterableAssertion -abstract class IterableToHaveNextAndNoneExpectationsSpec( - notToBeEmptyAndNone: Fun1, Expect.() -> Unit>, - notToBeEmptyAndNoneNullable: Fun1, (Expect.() -> Unit)?>, +abstract class IterableToHaveElementsAndNoneExpectationsSpec( + toHaveElementsAndNone: Fun1, Expect.() -> Unit>, + toHaveElementsAndNoneNullable: Fun1, (Expect.() -> Unit)?>, describePrefix: String = "[Atrium] " ) : IterableToContainEntriesSpecBase({ include(object : SubjectLessSpec>(describePrefix, - notToBeEmptyAndNone.forSubjectLess { toEqual(2.3) } + toHaveElementsAndNone.forSubjectLess { toEqual(2.3) } ) {}) include(object : SubjectLessSpec>(describePrefix, - notToBeEmptyAndNoneNullable.forSubjectLess { toEqual(2.3) } + toHaveElementsAndNoneNullable.forSubjectLess { toEqual(2.3) } ) {}) include(object : AssertionCreatorSpec>( describePrefix, oneToSeven().toList().asIterable(), - notToBeEmptyAndNone.forAssertionCreatorSpec("$toBeGreaterThanDescr: 10.0") { toBeGreaterThan(10.0) } + toHaveElementsAndNone.forAssertionCreatorSpec("$toBeGreaterThanDescr: 10.0") { toBeGreaterThan(10.0) } ) {}) include(object : AssertionCreatorSpec>( "$describePrefix[nullable Element] ", oneToSeven().toList().asIterable(), - notToBeEmptyAndNoneNullable.forAssertionCreatorSpec("$toBeGreaterThanDescr: 10.0") { toBeGreaterThan(10.0) } + toHaveElementsAndNoneNullable.forAssertionCreatorSpec("$toBeGreaterThanDescr: 10.0") { toBeGreaterThan(10.0) } ) {}) val containsNotDescr = DescriptionIterableAssertion.CONTAINS_NOT.getDefault() @@ -33,14 +33,14 @@ abstract class IterableToHaveNextAndNoneExpectationsSpec( nonNullableCases( describePrefix, - notToBeEmptyAndNone, - notToBeEmptyAndNoneNullable - ) { notToBeEmptyAndNoneFun -> + toHaveElementsAndNone, + toHaveElementsAndNoneNullable + ) { toHaveElementsAndNoneFun -> context("empty collection") { it("throws AssertionError as there needs to be at least one element") { expect { - expect(fluentEmpty()).notToBeEmptyAndNoneFun { toBeLessThan(1.0) } + expect(fluentEmpty()).toHaveElementsAndNoneFun { toBeLessThan(1.0) } }.toThrow { messageContains("$featureArrow$hasElement: false") } @@ -51,7 +51,7 @@ abstract class IterableToHaveNextAndNoneExpectationsSpec( context("happy case") { listOf(1.1, 2.2, 3.3).forEach { it("$toBeDescr($it) does not throw") { - expect(oneToSeven()).notToBeEmptyAndNoneFun { toEqual(1.1) } + expect(oneToSeven()).toHaveElementsAndNoneFun { toEqual(1.1) } } } } @@ -59,7 +59,7 @@ abstract class IterableToHaveNextAndNoneExpectationsSpec( context("failing cases; search string at different positions") { it("$toBeDescr(4.0) throws AssertionError") { expect { - expect(oneToSeven()).notToBeEmptyAndNoneFun { toEqual(4.0) } + expect(oneToSeven()).toHaveElementsAndNoneFun { toEqual(4.0) } }.toThrow { message { toContainRegex( @@ -78,18 +78,18 @@ abstract class IterableToHaveNextAndNoneExpectationsSpec( } } nullableCases(describePrefix) { - describeFun(notToBeEmptyAndNoneNullable) { - val notToBeEmptyAndNoneFun = notToBeEmptyAndNoneNullable.lambda + describeFun(toHaveElementsAndNoneNullable) { + val toHaveElementsAndNoneFun = toHaveElementsAndNoneNullable.lambda context("iterable ${oneToSeven().toList()}") { it("null does not throw") { - expect(oneToSeven() as Iterable).notToBeEmptyAndNoneFun(null) + expect(oneToSeven() as Iterable).toHaveElementsAndNoneFun(null) } } context("iterable ${oneToSevenNullable().toList()}") { it("null throws AssertionError") { expect { - expect(oneToSevenNullable()).notToBeEmptyAndNoneFun(null) + expect(oneToSevenNullable()).toHaveElementsAndNoneFun(null) }.toThrow { message { toContainRegex( @@ -107,7 +107,7 @@ abstract class IterableToHaveNextAndNoneExpectationsSpec( it("1.0 throws AssertionError") { expect { - expect(oneToSevenNullable()).notToBeEmptyAndNoneFun { toEqual(1.0) } + expect(oneToSevenNullable()).toHaveElementsAndNoneFun { toEqual(1.0) } }.toThrow { message { toContainRegex( diff --git a/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt b/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt index a85e75797..b81997bdd 100644 --- a/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt +++ b/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt @@ -2,7 +2,6 @@ package readme.examples import readme.examples.utils.expect import ch.tutteli.atrium.api.fluent.en_GB.* -import ch.tutteli.atrium.creating.Expect import org.spekframework.spek2.Spek import java.math.BigDecimal @@ -134,17 +133,17 @@ class MostExamplesSpec : Spek({ } test("ex-collection-any") { - expect(listOf(1, 2, 3, 4)).toHaveNextAndAny { + expect(listOf(1, 2, 3, 4)).toHaveElementsAndAny { toBeLessThan(0) } } test("ex-collection-none") { - expect(listOf(1, 2, 3, 4)).toHaveNextAndNone { + expect(listOf(1, 2, 3, 4)).toHaveElementsAndNone { toBeGreaterThan(2) } } test("ex-collection-all") { - expect(listOf(1, 2, 3, 4)).toHaveNextAndAll { + expect(listOf(1, 2, 3, 4)).toHaveElementsAndAll { toBeGreaterThan(2) } } @@ -214,8 +213,8 @@ class MostExamplesSpec : Spek({ } test("ex-map-4") { expect(mapOf("a" to 1, "b" to 2)) { - keys { toHaveNextAndAll { toStartWith("a") } } - values { toHaveNextAndNone { toBeGreaterThan(1) } } + keys { toHaveElementsAndAll { toStartWith("a") } } + values { toHaveElementsAndNone { toBeGreaterThan(1) } } } } test("ex-map-5") { diff --git a/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt b/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt index df4995b3c..8959fc058 100644 --- a/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt +++ b/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt @@ -79,7 +79,7 @@ object OwnExpectationFunctionsSpec : Spek({ //snippet-own-compose-4-start fun Expect.hasAdultChildren(): Expect = feature(Person::children) { - toHaveNextAndAll { + toHaveElementsAndAll { feature(Person::age).toBeGreaterThanOrEqualTo(18) } } @@ -101,17 +101,17 @@ object OwnExpectationFunctionsSpec : Spek({ test("ex-own-compose-5"){ expect(Person("Susanne", "Whitley", 43, listOf(Person("Petra", "Whitley", 12, listOf())))) .children { // using the fun -> assertion group, ergo sub-assertions don't fail fast - toHaveNextAndNone { + toHaveElementsAndNone { feature { f(it::firstName) }.toStartWith("Ro") } - toHaveNextAndAll { + toHaveElementsAndAll { feature { f(it::lastName) }.toEqual("Whitley") } } // subject is still Person here .apply { // only evaluated because the previous assertion group holds children // using the val -> subsequent assertions are about children and fail fast .toHaveSize(2) - .toHaveNextAndAny { + .toHaveElementsAndAny { feature { f(it::age) }.toBeGreaterThan(18) } } // subject is still Person here due to the `apply`