diff --git a/README.md b/README.md
index 231b874cc..d25c67b49 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#L24) ↓ [Output](#ex-single)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L25) ↓ [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#L40) ↓ [Output](#ex-group)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L41) ↓ [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#L64) ↓ [Output](#ex-toThrow1)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L65) ↓ [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:67)
- ⚬ readme.examples.MostExamplesSpec$1$7$1.invoke(MostExamplesSpec.kt:22)
- ⚬ readme.examples.MostExamplesSpec$1$7.invoke(MostExamplesSpec.kt:266)
- ⚬ readme.examples.MostExamplesSpec$1$7.invoke(MostExamplesSpec.kt:22)
+ ⚬ 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)
```
@@ -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#L71) ↓ [Output](#ex-toThrow2)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L72) ↓ [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#L77) ↓ [Output](#ex-toThrow3)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L78) ↓ [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#L85) ↓ [Output](#ex-notToThrow)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L86) ↓ [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: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)
+ ⚬ 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)
» cause: java.lang.RuntimeException
» message: "a cause" <1234789>
» stacktrace:
- ⚬ readme.examples.MostExamplesSpec$1$10$1.invoke(MostExamplesSpec.kt:88)
+ ⚬ readme.examples.MostExamplesSpec$1$10$1.invoke(MostExamplesSpec.kt:89)
```
@@ -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#L92) ↓ [Output](#ex-type-assertions-1)
+↑ [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)
```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#L98) ↓ [Output](#ex-type-assertions-2)
+↑ [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)
```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#L106) ↓ [Output](#ex-nullable-1)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L107) ↓ [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#L110) ↓ [Output](#ex-nullable-2)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L111) ↓ [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#L115) ↓ [Output](#ex-nullable-3)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L116) ↓ [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#L120) ↓ [Output](#ex-nullable-4)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L121) ↓ [Output](#ex-nullable-4)
```text
expected that subject: null
@@ -978,7 +978,7 @@ then you can skip now to the next section (otherwise click on the arrow to expan
## Collection Assertions
-Atrium provides assertion builders which allow to make sophisticated `contains` assertions for `Iterable`.
+Atrium provides assertion builders which allow to make sophisticated `toContain` assertions for `Iterable`.
Such a building process allows you to define very specific assertions, where the process is guided by a fluent builder pattern.
You can either use such an
[Assertion Builder](#sophisticated-assertion-builders)
@@ -991,9 +991,9 @@ The following sub sections show both use cases by examples.
```kotlin
-expect(listOf(1, 2, 2, 4)).contains(2, 3)
+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#L124) ↓ [Output](#ex-collection-short-1)
+↑ [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)
```text
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
@@ -1004,8 +1004,8 @@ expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>
```
-The assertion function `contains(2, 3)` is a shortcut for using a
-[Sophisticated Assertion Builder](#sophisticated-assertion-builders) -- it actually calls `contains.inAnyOrder.atLeast(1).values(2, 3)`.
+The assertion function `toContain(2, 3)` is a shortcut for using a
+[Sophisticated Assertion Builder](#sophisticated-assertion-builders) -- it actually calls `toContain.inAnyOrder.atLeast(1).values(2, 3)`.
This is reflected in the output, which tells us that we expected that the `number of such entries`, which is actually `0`, `is at least: 1`.
@@ -1027,12 +1027,12 @@ Following an example:
```kotlin
-expect(listOf(1, 2, 2, 4)).contains(
+expect(listOf(1, 2, 2, 4)).toContain(
{ toBeLessThan(0) },
{ toBeGreaterThan(2).toBeLessThan(4) }
)
```
-↑ [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)
+↑ [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)
```text
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
@@ -1051,28 +1051,34 @@ expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>
In the above example, neither of the two lambdas matched any elements and thus both are reported as failing (sub) assertions.
-Another `contains` shortcut function which Atrium provides for `Iterable` is kind of
-the opposite of `inAnyOrder.atLeast(1)` and is named `containsExactly`.
+Another `toContain` shortcut function which Atrium provides for `Iterable` is kind of
+the opposite of `inAnyOrder.atLeast(1)` and is named `toContainExactly`.
Again, Atrium provides two overloads for it, one for values,
-e.g. `containsExactly(1, 2)` which calls `contains.inOrder.only.values(1, 2)`
+e.g. `toContainExactly(1, 2)` which calls `toContain.inOrder.only.values(1, 2)`
and a second one which expects one or more `assertionCreator`-lambda,
-e.g. `containsExactly( { toBeGreaterThan(5) }, { toBeLessThan(10) })`
-which calls `contains.inOrder.only.elements({ toBeGreaterThan(5) }, { toBeLessThan(10) })`.
+e.g. `toContainExactly( { toBeGreaterThan(5) }, { toBeLessThan(10) })`
+which calls `toContain.inOrder.only.elements({ toBeGreaterThan(5) }, { toBeLessThan(10) })`.
We will spare the examples here and show them in the following sections.
-Notice that you can pass `null` to `containsExactly` instead of an `assertionCreator`-lambda to match `null`.
+Notice that you can pass `null` to `toContainExactly` instead of an `assertionCreator`-lambda to match `null`.
This makes of course only sense if your `Iterable` contains nullable elements.
-Atrium provides also a `containsNot` shortcut function.
-Furthermore, it provides aliases for `contains` and `containsNot` named `any` and `none`, which might be a better
-choice if you think in terms of: expect a predicate holds. These two are completed with an `all` assertion function.
+Atrium provides also a `notToContain` shortcut function.
+Furthermore, it provides aliases for `toContain` and `notToContain` named `toHaveNextAndAny` and `toHaveNextAndNone`,
+which might be a better choice if you think in terms of: expect a predicate holds.
+These two are completed with an `toHaveNextAndAll` assertion function.
+
+
+
Following each in action:
```kotlin
-expect(listOf(1, 2, 3, 4)).any { toBeLessThan(0) }
+expect(listOf(1, 2, 3, 4)).toHaveNextAndAny {
+ toBeLessThan(0)
+}
```
-↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L135) ↓ [Output](#ex-collection-any)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L136) ↓ [Output](#ex-collection-any)
```text
expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>)
@@ -1087,9 +1093,11 @@ expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>
```kotlin
-expect(listOf(1, 2, 3, 4)).none { toBeGreaterThan(2) }
+expect(listOf(1, 2, 3, 4)).toHaveNextAndNone {
+ toBeGreaterThan(2)
+}
```
-↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L138) ↓ [Output](#ex-collection-none)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L141) ↓ [Output](#ex-collection-none)
```text
expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>)
@@ -1106,9 +1114,11 @@ expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>
```kotlin
-expect(listOf(1, 2, 3, 4)).all { toBeGreaterThan(2) }
+expect(listOf(1, 2, 3, 4)).toHaveNextAndAll {
+ 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-all)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L146) ↓ [Output](#ex-collection-all)
```text
expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>)
@@ -1124,9 +1134,9 @@ expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>
### Sophisticated Assertion Builders
Sophisticated assertion builders implement a fluent builder pattern.
-To use the assertion builder for sophisticated `Iterable`-contains-assertions, you can type `contains`
--- as you would when using the [Shortcut Functions](#shortcut-functions) `contains` --
-but type `.` as next step (so that you are using the property `contains` instead of one of the shortcut functions).
+To use the assertion builder for sophisticated `Iterable`-toContain-assertions, you can type `toContain`
+-- as you would when using the [Shortcut Functions](#shortcut-functions) `toContain` --
+but type `.` as next step (so that you are using the property `toContain` instead of one of the shortcut functions).
Currently, the builder provides two options, either `inAnyOrder` or `inOrder`.
In case you are using an IDE, you do not really have to think too much -- use code completion;
the fluent builders will guide you through your decision-making 😊
@@ -1136,9 +1146,9 @@ Following on the last section we will start with an `inOrder` example:
```kotlin
-expect(listOf(1, 2, 2, 4)).contains.inOrder.only.entries({ toBeLessThan(3) }, { toBeLessThan(2) })
+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#L145) ↓ [Output](#ex-collection-builder-1)
+↑ [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)
```text
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
@@ -1184,9 +1194,9 @@ and we happily answer your question there.
```kotlin
-expect(listOf(1, 2, 2, 4)).contains.inOrder.only.values(1, 2, 2, 3, 4)
+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#L148) ↓ [Output](#ex-collection-builder-2)
+↑ [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)
```text
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
@@ -1209,9 +1219,9 @@ expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>
```kotlin
-expect(listOf(1, 2, 2, 4)).contains.inAnyOrder.atLeast(1).butAtMost(2).entries({ toBeLessThan(3) })
+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#L151) ↓ [Output](#ex-collection-builder-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)
```text
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
@@ -1226,9 +1236,9 @@ expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>
```kotlin
-expect(listOf(1, 2, 2, 4)).contains.inAnyOrder.only.values(1, 2, 3, 4)
+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#L154) ↓ [Output](#ex-collection-builder-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)
```text
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
@@ -1245,9 +1255,9 @@ expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>
```kotlin
-expect(listOf(1, 2, 2, 4)).contains.inAnyOrder.only.values(4, 3, 2, 2, 1)
+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#L157) ↓ [Output](#ex-collection-builder-5)
+↑ [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)
```text
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
@@ -1277,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#L161) ↓ [Output](#ex-map-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)
```text
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
@@ -1301,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#L164) ↓ [Output](#ex-map-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)
```text
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
@@ -1315,7 +1325,7 @@ expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
```
-In case you expect that a map only contains certain entries, then you can use the shortcut `containsOnly`.
+In case you expect that a map only contains certain entries, then you can use the shortcut `toContainOnly`.
Again both overloads are provided, one for key-value `Pair`s:
@@ -1323,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#L172) ↓ [Output](#ex-map-only-1)
+↑ [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)
```text
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
@@ -1337,7 +1347,7 @@ expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
```
-And the other overload which expects a `KeyValue` and allows to define sub asertions for the value:
+And the other overload which expects a `KeyValue` and allows defining sub asertions for the value:
@@ -1348,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#L175) ↓ [Output](#ex-map-only-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)
```text
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
@@ -1366,8 +1376,8 @@ expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
### Sophisticated Assertion Builders
-Most functionality for `Map.contains` are provided as shortcut functions but there is a handy one
-in case you deal with ordered Maps: `.contains.inOrder.only`
+Most functionality for `Map.toContain` are provided as shortcut functions but there is a handy one
+in case you deal with ordered Maps: `.toContain.inOrder.only`
There are multiple methods finalising the building process : `entry`/`entries`/`entriesOf` where `entry` and `entries`
again provide two overloads, one expecting key-value `Pair`s:
@@ -1376,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#L183) ↓ [Output](#ex-map-builder-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)
```text
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
@@ -1394,7 +1404,7 @@ expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
```
-And the other expecting `KeyValue`s which allow to specify sub assertions for the value
+And the other expecting `KeyValue`s which allow specifying sub assertions for the value
@@ -1403,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#L186) ↓ [Output](#ex-map-builder-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)
```text
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
@@ -1440,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#L196) ↓ [Output](#ex-map-3)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L203) ↓ [Output](#ex-map-3)
```text
expected that subject: {bernstein=Person(firstName=Leonard, lastName=Bernstein, age=50)} (java.util.Collections.SingletonMap <1234789>)
@@ -1456,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 { all { toStartWith("a") } }
- values { none { toBeGreaterThan(1) } }
+ keys { toHaveNextAndAll { toStartWith("a") } }
+ values { toHaveNextAndNone { toBeGreaterThan(1) } }
}
```
-↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L208) ↓ [Output](#ex-map-4)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L215) ↓ [Output](#ex-map-4)
```text
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
@@ -1490,7 +1500,7 @@ then it will come in handy:
```kotlin
-expect(linkedMapOf("a" to 1, "b" to 2)).asEntries().contains.inOrder.only.entries(
+expect(linkedMapOf("a" to 1, "b" to 2)).asEntries().toContain.inOrder.only.entries(
{ isKeyValue("a", 1) },
{
key.toStartWith("a")
@@ -1498,7 +1508,7 @@ expect(linkedMapOf("a" to 1, "b" to 2)).asEntries().contains.inOrder.only.entrie
}
)
```
-↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L214) ↓ [Output](#ex-map-5)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L221) ↓ [Output](#ex-map-5)
```text
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
@@ -1594,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#L224) ↓ [Output](#ex-because-1)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L231) ↓ [Output](#ex-because-1)
```text
expected that subject: "filename?" <1234789>
@@ -1809,7 +1819,7 @@ For instance, for the following assertion (which fails):
```kotlin
-expect(listOf(1, 2, 3)).contains.inOrder.only.values(1, 3)
+expect(listOf(1, 2, 3)).toContain.inOrder.only.values(1, 3)
```
@@ -1871,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#L237) ↓ [Output](#ex-add-info-3)
+↑ [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)
```text
expected that subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpec$1$39$1 <1234789>)
@@ -1886,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:242)
- ⚬ readme.examples.MostExamplesSpec$1$39$1.invoke(MostExamplesSpec.kt:22)
- ⚬ readme.examples.MostExamplesSpec$1$39.invoke(MostExamplesSpec.kt:266)
- ⚬ readme.examples.MostExamplesSpec$1$39.invoke(MostExamplesSpec.kt:22)
+ ⚬ 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)
» cause: java.lang.UnsupportedOperationException
» message: "not supported" <1234789>
» stacktrace:
- ⚬ readme.examples.MostExamplesSpec$1$39$1.invoke(MostExamplesSpec.kt:240)
+ ⚬ readme.examples.MostExamplesSpec$1$39$1.invoke(MostExamplesSpec.kt:247)
```
@@ -1914,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#L247) ↓ [Output](#ex-pitfall-1)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L254) ↓ [Output](#ex-pitfall-1)
```text
expected that subject: 10 (java.math.BigDecimal <1234789>)
@@ -1932,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#L250) ↓ [Output](#ex-pitfall-2)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L257) ↓ [Output](#ex-pitfall-2)
```text
expected that subject: [1] (java.util.Collections.SingletonList <1234789>)
@@ -2181,7 +2191,9 @@ Another example: assert the person has children which are all adults (assuming 1
```kotlin
fun Expect.hasAdultChildren(): Expect =
feature(Person::children) {
- all { feature(Person::age).toBeGreaterThanOrEqualTo(18) }
+ toHaveNextAndAll {
+ feature(Person::age).toBeGreaterThanOrEqualTo(18)
+ }
}
```
@@ -2198,7 +2210,7 @@ but we do not have to, as `all` already checks that there is at least one elemen
expect(Person("Susanne", "Whitley", 43, listOf()))
.hasAdultChildren()
```
-↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L89) ↓ [Output](#ex-own-compose-4)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L91) ↓ [Output](#ex-own-compose-4)
```text
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[]) (readme.examples.Person <1234789>)
@@ -2229,18 +2241,24 @@ 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
- none { feature { f(it::firstName) }.toStartWith("Ro") }
- all { feature { f(it::lastName) }.toEqual("Whitley") }
+ toHaveNextAndNone {
+ feature { f(it::firstName) }.toStartWith("Ro")
+ }
+ toHaveNextAndAll {
+ 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)
- .any { feature { f(it::age) }.toBeGreaterThan(18) }
+ .toHaveNextAndAny {
+ feature { f(it::age) }.toBeGreaterThan(18)
+ }
} // subject is still Person here due to the `apply`
.children // using the val -> subsequent assertions are about children and fail fast
.toHaveSize(2)
```
-↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L99) ↓ [Output](#ex-own-compose-5)
+↑ [Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L101) ↓ [Output](#ex-own-compose-5)
```text
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[Person(firstName=Petra, lastName=Whitley, age=12, children=[])]) (readme.examples.Person <1234789>)
@@ -2256,10 +2274,10 @@ Enough of feature assertions. Let's move on to an example where we want to reuse
arguments. Say we have a function which returns a list of first name / last name `Pair`s.
We want to assert that the pairs contain only the first name / last name pairs of certain `Person`s in any order.
[Collection Assertions](#collection-assertions) will help us with this.
-However, `contains.inAnyOrder.values` expects `Pair`s.
+However, `toContain.inAnyOrder.values` expects `Pair`s.
So we have to map from `Person` to `Pair` upfront.
As we have a variable length argument list and want to pass it to a variable length argument list, this cannot be done with a simple `map` from Kotlin.
-And it gets worse if we want to use `contains.inAnyOrder.entries` which expects at least one `assertionCreator`-lambda (`Expect.() -> Unit`)
+And it gets worse if we want to use `toContain.inAnyOrder.entries` which expects at least one `assertionCreator`-lambda (`Expect.() -> Unit`)
because Kotlin cannot infer the types automatically.
`mapArguments` to the rescue, you can write the assertion function as follows:
@@ -2273,7 +2291,7 @@ fun >> Expect.areNamesOf(
person: Person, vararg otherPersons: Person
): Expect {
val (pair, otherPairs) = mapArguments(person, otherPersons) { it.firstName to it.lastName }
- return contains.inAnyOrder.only.values(pair, *otherPairs)
+ return toContain.inAnyOrder.only.values(pair, *otherPairs)
}
```
@@ -2296,7 +2314,7 @@ fun >> Expect.sameInitialsAs(
first.toStartWith(it.firstName[0].toString())
second.toStartWith(it.lastName[0].toString())
}
- return contains.inOrder.only.entries(first, *others)
+ return toContain.inOrder.only.entries(first, *others)
}
```
@@ -2378,7 +2396,7 @@ What are the benefits of creating an own expectation verb:
-- you can define some default configurations like show only failing assertions for `contains.inOrder.only`
+- you can define some default configurations like show only failing assertions for `toContain.inOrder.only`
What are the drawbacks:
@@ -2645,21 +2663,21 @@ You find frequently asked questions below.
If your question is not answered below, then please do not hesitate and ask your question in the [atrium Slack channel](https://kotlinlang.slack.com/messages/C887ZKGCQ).
In case you do not have an account for kotlinlang.slack.com yet, then please [Invite yourself](https://slack.kotlinlang.org/).
-## Are there contains/any/none/all assertions for `Sequence`/`Array`?
+## Are there toContain/toHaveNextAndAll/None/All expectation functions for `Sequence`/`Array`?
Atrium does not provide extension function applicable to `Expect>` (or `Array`) directly,
because they would basically duplicate the functions available for `Iterable`.
-However, Atrium provides `asIterable` so that you can turn `Expect>`
-into `Expect>`. An example:
+However, Atrium provides `asIterable` and `asList` so that you can turn `Expect>`
+into `Expect>` or `Expect>`. An example:
```kotlin
-expect(sequenceOf(1, 2, 3)).asIterable().contains(2)
+expect(sequenceOf(1, 2, 3)).asIterable().toContain(2)
```
-Likewise you can turn an `Expect>`, `Expect` etc. into an `Expect>` with `asList`.
+Likewise, you can turn an `Expect>`, `Expect` etc. into an `Expect>` with `asList`.
Feel free vote for [first class support for Array and Sequence in api-fluent](https://github.com/robstoll/atrium/issues/459).
@@ -2673,7 +2691,7 @@ as follows:
```kotlin
-expect(sequenceOf(1, 2, 3)).feature { f(it::asIterable) }.contains(2)
+expect(sequenceOf(1, 2, 3)).feature { f(it::asIterable) }.toContain(2)
```
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceContainsCheckers.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceContainsCheckers.kt
index 486a9b2c5..fdae4ef04 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceContainsCheckers.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceContainsCheckers.kt
@@ -21,7 +21,7 @@ import kotlin.jvm.JvmName
*
* @return The newly created builder.
* @throws IllegalArgumentException In case [times] is smaller than zero.
- * @throws IllegalArgumentException In case [times] equals to zero; use [containsNot] instead.
+ * @throws IllegalArgumentException In case [times] equals to zero; use [notToContain] instead.
*/
fun CharSequenceContains.EntryPointStep.atLeast(
times: Int
@@ -39,7 +39,7 @@ fun CharSequenceContains.EntryPointStep<
*
* @return The newly created builder.
* @throws IllegalArgumentException In case [times] is smaller than zero.
- * @throws IllegalArgumentException In case [times] equals to zero; use [containsNot] instead.
+ * @throws IllegalArgumentException In case [times] equals to zero; use [notToContain] instead.
* @throws IllegalArgumentException In case [times] of this `at most` restriction equals to the number of the
* `at least` restriction; use the [exactly] restriction instead.
*/
@@ -64,7 +64,7 @@ fun AtLeastCheckerStep.butAtMost(
*
* @return The newly created builder.
* @throws IllegalArgumentException In case [times] is smaller than zero.
- * @throws IllegalArgumentException In case [times] equals to zero; use [containsNot] instead.
+ * @throws IllegalArgumentException In case [times] equals to zero; use [notToContain] instead.
*/
fun CharSequenceContains.EntryPointStep.exactly(
times: Int
@@ -84,7 +84,7 @@ fun CharSequenceContains.EntryPointStep<
*
* @return The newly created builder.
* @throws IllegalArgumentException In case [times] is smaller than zero.
- * @throws IllegalArgumentException In case [times] equals to zero; use [containsNot] instead.
+ * @throws IllegalArgumentException In case [times] equals to zero; use [notToContain] instead.
* @throws IllegalArgumentException In case [times] equals to one; use [exactly] instead.
*/
fun CharSequenceContains.EntryPointStep.atMost(
@@ -106,7 +106,7 @@ fun CharSequenceContains.EntryPointStep<
*
* @return The newly created builder.
* @throws IllegalArgumentException In case [times] is smaller than zero.
- * @throws IllegalArgumentException In case [times] equals to zero; use [containsNot] instead.
+ * @throws IllegalArgumentException In case [times] equals to zero; use [notToContain] instead.
*/
fun CharSequenceContains.EntryPointStep.notOrAtMost(
times: Int
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/creating/charsequence/contains/impl/StaticNames.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/creating/charsequence/contains/impl/StaticNames.kt
index f12197132..a7c534e72 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/creating/charsequence/contains/impl/StaticNames.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/creating/charsequence/contains/impl/StaticNames.kt
@@ -7,6 +7,7 @@ import ch.tutteli.atrium.logic.creating.charsequence.contains.steps.AtLeastCheck
import kotlin.reflect.KFunction3
internal object StaticNames {
+ //TODO rename with 0.18.0 to notToContain
val containsNotValuesFun = run {
val f: KFunction3, Any, Array, Expect> =
Expect::notToContain
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/creating/iterable/contains/impl/StaticNames.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/creating/iterable/contains/impl/StaticNames.kt
index 2335ea15a..b3d54e7d9 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/creating/iterable/contains/impl/StaticNames.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/creating/iterable/contains/impl/StaticNames.kt
@@ -8,9 +8,10 @@ import ch.tutteli.atrium.logic.creating.iterable.contains.steps.AtLeastCheckerSt
import kotlin.reflect.KFunction3
internal object StaticNames {
+ //TODO rename with 0.18.0 notToContain
val containsNotValuesFun = run {
val f: KFunction3>, Double, Array, Expect>> =
- Expect>::containsNot
+ Expect>::notToContain
f.name
}
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 8dacc4c37..50b9d4ea4 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
@@ -20,6 +20,7 @@ import kotlin.jvm.JvmName
*
* @return The newly created builder.
*/
+@Deprecated("Use toContain; will be removed with 1.0.0 at the latest", ReplaceWith("this.toContain"))
val > Expect.contains: IterableLikeContains.EntryPointStep
get() = _logic.builderContainsInIterableLike(::identity)
@@ -29,6 +30,7 @@ val > Expect.contains: IterableLikeContains.EntryPointStep
*
* @return The newly created builder.
*/
+@Deprecated("Use notToContain; will be removed with 1.0.0 at the latest", ReplaceWith("this.notToContain"))
val > Expect.containsNot: NotCheckerStep
get() = _logic.builderContainsNotInIterableLike(::identity)
@@ -49,8 +51,12 @@ val > Expect.containsNot: NotCheckerStep(expected, *otherExpected)")
+)
fun > Expect.contains(expected: E, vararg otherExpected: E): Expect =
- contains.inAnyOrder.atLeast(1).values(expected, *otherExpected)
+ toContain.inAnyOrder.atLeast(1).values(expected, *otherExpected)
/**
* Expects that the subject of `this` expectation (an [Iterable]) contains an entry holding the
@@ -65,8 +71,12 @@ fun > Expect.contains(expected: E, vararg otherExpected: E
*
* @return an [Expect] for the subject of `this` expectation.
*/
+@Deprecated(
+ "Use toContain; will be removed with 1.0.0 at the latest",
+ ReplaceWith("this.toContain(assertionCreatorOrNull)")
+)
fun > Expect.contains(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect =
- contains.inAnyOrder.atLeast(1).entry(assertionCreatorOrNull)
+ toContain.inAnyOrder.atLeast(1).entry(assertionCreatorOrNull)
/**
* Expects that the subject of `this` expectation (an [Iterable]) contains an entry holding the
@@ -84,10 +94,14 @@ fun > Expect.contains(assertionCreatorOrNull: (Expe
*
* @return an [Expect] for the subject of `this` expectation.
*/
+@Deprecated(
+ "Use toContain; will be removed with 1.0.0 at the latest",
+ ReplaceWith("this.toContain(assertionCreatorOrNull, *otherAssertionCreatorsOrNulls)")
+)
fun > Expect.contains(
assertionCreatorOrNull: (Expect.() -> Unit)?,
vararg otherAssertionCreatorsOrNulls: (Expect.() -> Unit)?
-): Expect = contains.inAnyOrder.atLeast(1).entries(assertionCreatorOrNull, *otherAssertionCreatorsOrNulls)
+): Expect = toContain.inAnyOrder.atLeast(1).entries(assertionCreatorOrNull, *otherAssertionCreatorsOrNulls)
/**
* Expects that the subject of `this` expectation (an [Iterable]) contains only
@@ -101,8 +115,12 @@ fun > Expect.contains(
*
* @return an [Expect] for the subject of `this` expectation.
*/
+@Deprecated(
+ "Use toContainExactly; will be removed with 1.0.0 at the latest",
+ ReplaceWith("this.toContainExactly(expected, *otherExpected)")
+)
fun > Expect.containsExactly(expected: E, vararg otherExpected: E): Expect =
- contains.inOrder.only.values(expected, *otherExpected)
+ toContain.inOrder.only.values(expected, *otherExpected)
/**
* Expects that the subject of `this` expectation (an [Iterable]) contains only an entry holding
@@ -121,8 +139,12 @@ fun > Expect.containsExactly(expected: E, vararg otherExpe
*
* @return an [Expect] for the subject of `this` expectation.
*/
+@Deprecated(
+ "Use toContainExactly; will be removed with 1.0.0 at the latest",
+ ReplaceWith("this.toContainExactly(assertionCreatorOrNull)")
+)
fun > Expect.containsExactly(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect =
- contains.inOrder.only.entry(assertionCreatorOrNull)
+ toContain.inOrder.only.entry(assertionCreatorOrNull)
/**
* Expects that the subject of `this` expectation (an [Iterable]) contains only an entry holding
@@ -144,10 +166,14 @@ fun > Expect.containsExactly(assertionCreatorOrNull
*
* @return an [Expect] for the subject of `this` expectation.
*/
+@Deprecated(
+ "Use toContainExactly; will be removed with 1.0.0 at the latest",
+ ReplaceWith("this.toContainExactly(assertionCreatorOrNull, *otherAssertionCreatorsOrNulls)")
+)
fun > Expect.containsExactly(
assertionCreatorOrNull: (Expect.() -> Unit)?,
vararg otherAssertionCreatorsOrNulls: (Expect.() -> Unit)?
-): Expect = contains.inOrder.only.entries(assertionCreatorOrNull, *otherAssertionCreatorsOrNulls)
+): Expect = toContain.inOrder.only.entries(assertionCreatorOrNull, *otherAssertionCreatorsOrNulls)
/**
* Expects that the subject of `this` expectation (an [Iterable]) contains only elements of [expectedIterableLike]
@@ -166,9 +192,13 @@ fun > Expect.containsExactly(
*
* @since 0.13.0
*/
+@Deprecated(
+ "Use toContainExactlyElementsOf; will be removed with 1.0.0 at the latest",
+ ReplaceWith("this.toContainExactlyElementsOf(expectedIterableLike)")
+)
inline fun > Expect.containsExactlyElementsOf(
expectedIterableLike: IterableLike
-): Expect = contains.inOrder.only.elementsOf(expectedIterableLike)
+): Expect = toContain.inOrder.only.elementsOf(expectedIterableLike)
/** Expects that the subject of `this` expectation (an [Iterable]) contains all elements of [expectedIterableLike].
*
@@ -185,9 +215,13 @@ inline fun > Expect.containsExactlyElementsOf(
*
* @since 0.13.0
*/
+@Deprecated(
+ "Use toContainElementsOf; will be removed with 1.0.0 at the latest",
+ ReplaceWith("this.toContainElementsOf(expectedIterableLike)")
+)
inline fun > Expect.containsElementsOf(
expectedIterableLike: IterableLike
-): Expect = contains.inAnyOrder.atLeast(1).elementsOf(expectedIterableLike)
+): Expect = toContain.inAnyOrder.atLeast(1).elementsOf(expectedIterableLike)
/**
* Expects that the subject of `this` expectation (an [Iterable]) has at least one element and
@@ -197,8 +231,12 @@ inline fun > Expect.containsElementsOf(
*
* @return an [Expect] for the subject of `this` expectation.
*/
+@Deprecated(
+ "Use notToContain; will be removed with 1.0.0 at the latest",
+ ReplaceWith("this.notToContain(expected, *otherExpected)")
+)
fun > Expect.containsNot(expected: E, vararg otherExpected: E): Expect =
- containsNot.values(expected, *otherExpected)
+ notToContain.values(expected, *otherExpected)
//TODO 0.18.0 move to iterableExpectations.kt
/**
@@ -260,8 +298,12 @@ 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)")
+)
fun > Expect.any(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect =
- contains.inAnyOrder.atLeast(1).entry(assertionCreatorOrNull)
+ toContain.inAnyOrder.atLeast(1).entry(assertionCreatorOrNull)
/**
* Expects that the subject of `this` expectation (an [Iterable]) has at least one element and
@@ -272,8 +314,12 @@ 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)")
+)
fun > Expect.none(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect =
- containsNot.entry(assertionCreatorOrNull)
+ notToContain.entry(assertionCreatorOrNull)
/**
* Expects that the subject of `this` expectation (an [Iterable]) has at least one element and
@@ -282,6 +328,10 @@ fun > Expect.none(assertionCreatorOrNull: (Expect(assertionCreatorOrNull)")
+)
fun > Expect.all(assertionCreatorOrNull: (Expect.() -> Unit)?): Expect =
_logicAppend { all(::identity, assertionCreatorOrNull) }
@@ -293,6 +343,10 @@ 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()")
+)
fun > Expect.hasNext(): Expect =
_logicAppend { hasNext(::identity) }
@@ -303,6 +357,10 @@ fun > Expect.hasNext(): Expect =
*
* @since 0.9.0
*/
+@Deprecated(
+ "Use notToHaveNext; will be removed with 1.0.0 at the latest",
+ ReplaceWith("this.notToHaveNext()")
+)
fun > Expect.hasNotNext(): Expect =
_logicAppend { hasNotNext(::identity) }
@@ -313,6 +371,10 @@ fun > Expect.hasNotNext(): Expect =
*
* @since 0.14.0
*/
+@Deprecated(
+ "Use notToContainDuplicates; will be removed with 1.0.0 at the latest",
+ ReplaceWith("this.notToContainDuplicates()")
+)
fun > Expect.containsNoDuplicates(): Expect =
_logicAppend { containsNoDuplicates(::identity) }
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableLikeContainsCheckers.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableLikeContainsCheckers.kt
index 34c7a33a9..967dac023 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableLikeContainsCheckers.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/iterableLikeContainsCheckers.kt
@@ -20,7 +20,7 @@ import kotlin.jvm.JvmName
*
* @return The newly created builder.
* @throws IllegalArgumentException In case [times] is smaller than zero.
- * @throws IllegalArgumentException In case [times] equals to zero; use [containsNot] instead.
+ * @throws IllegalArgumentException In case [times] equals to zero; use [notToContain] instead.
*
* @since 0.14.0 -- API existed for [Iterable] but not for [IterableLike].
*/
@@ -40,7 +40,7 @@ fun IterableLikeContains.Ent
*
* @return The newly created builder.
* @throws IllegalArgumentException In case [times] is smaller than zero.
- * @throws IllegalArgumentException In case [times] equals to zero; use [containsNot] instead.
+ * @throws IllegalArgumentException In case [times] equals to zero; use [notToContain] instead.
* @throws IllegalArgumentException In case [times] of this `at most` restriction equals to the number of the
* `at least` restriction; use the [exactly] restriction instead.
*
@@ -68,7 +68,7 @@ fun AtLeastCheckerStep IterableLikeContains.Ent
*
* @return The newly created builder.
* @throws IllegalArgumentException In case [times] is smaller than zero.
- * @throws IllegalArgumentException In case [times] equals to zero; use [containsNot] instead.
+ * @throws IllegalArgumentException In case [times] equals to zero; use [notToContain] instead.
* @throws IllegalArgumentException In case [times] equals to one; use [exactly] instead.
*
* @since 0.14.0 -- API existed for [Iterable] but not for [IterableLike].
@@ -114,7 +114,7 @@ fun IterableLikeContains.Ent
*
* @return The newly created builder.
* @throws IllegalArgumentException In case [times] is smaller than zero.
- * @throws IllegalArgumentException In case [times] equals to zero; use [containsNot] instead.
+ * @throws IllegalArgumentException In case [times] equals to zero; use [notToContain] instead.
*
* @since 0.14.0 -- API existed for [Iterable] but not for [IterableLike].
*/
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 21ff4cfe5..7f2a92e45 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
@@ -10,7 +10,7 @@ object IterableExpectationsSpec : ch.tutteli.atrium.specs.integration.IterableEx
fun1, Expect.() -> Unit>(Expect>::min),
feature0, Int>(Expect>::max),
fun1, Expect.() -> Unit>(Expect>::max),
- fun0(Expect>::containsNoDuplicates)
+ fun0(Expect>::notToContainDuplicates)
) {
@Suppress("unused", "UNUSED_VALUE")
@@ -24,7 +24,7 @@ object IterableExpectationsSpec : ch.tutteli.atrium.specs.integration.IterableEx
a1 = a1.notToContainDuplicates()
a1b = a1b.toHaveNext()
- a1b = a1b.hasNotNext()
+ a1b = a1b.notToHaveNext()
a1b = a1b.notToContainDuplicates()
star = star.toHaveNext()
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableNoneExpectationsSpec.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableNoneExpectationsSpec.kt
index c67236650..56295ef79 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableNoneExpectationsSpec.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableNoneExpectationsSpec.kt
@@ -12,27 +12,27 @@ class IterableNoneExpectationsSpec : Spek({
include(BuilderSpec)
}) {
object PredicateSpec : ch.tutteli.atrium.specs.integration.IterableNoneExpectationsSpec(
- fun1(Expect>::none),
- fun1(Expect>::none).withNullableSuffix(),
+ fun1(Expect>::toHaveNextAndNone),
+ fun1(Expect>::toHaveNextAndNone).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.IterableNoneExpectationsSpec(
- functionDescription to C::containsNotFun,
- (functionDescription to C::containsNotNullableFun).withNullableSuffix(),
+ functionDescription to C::notToContainFun,
+ (functionDescription to C::notToContainNullableFun).withNullableSuffix(),
"[Atrium][Builder] "
)
companion object : IterableToContainSpecBase() {
val functionDescription = "$notToContain.$entry"
- private fun containsNotFun(expect: Expect>, a: Expect.() -> Unit) =
- expect.containsNot.entry(a)
+ private fun notToContainFun(expect: Expect>, a: Expect.() -> Unit) =
+ expect.notToContain.entry(a)
- private fun containsNotNullableFun(expect: Expect>, a: (Expect.() -> Unit)?) =
- expect.containsNot.entry(a)
+ private fun notToContainNullableFun(expect: Expect>, a: (Expect.() -> Unit)?) =
+ expect.notToContain.entry(a)
}
@Suppress("unused", "UNUSED_VALUE")
@@ -42,9 +42,9 @@ class IterableNoneExpectationsSpec : Spek({
var subList: Expect> = notImplemented()
var star: Expect> = notImplemented()
- list = list.none{}
- nList = nList.none{}
- subList = subList.none{}
- star = star.none{}
+ list = list.toHaveNextAndNone {}
+ nList = nList.toHaveNextAndNone {}
+ subList = subList.toHaveNextAndNone {}
+ star = star.toHaveNextAndNone {}
}
}
diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToContainSpecBase.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToContainSpecBase.kt
index 29849d8db..e9099af95 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToContainSpecBase.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/IterableToContainSpecBase.kt
@@ -10,9 +10,9 @@ import kotlin.reflect.KFunction4
import kotlin.reflect.KProperty
abstract class IterableToContainSpecBase {
- private val toContainProp: KProperty<*> = Expect>::contains
+ private val toContainProp: KProperty<*> = Expect>::toContain
protected val toContain = toContainProp.name
- private val notToContainProp: KProperty<*> = Expect>::containsNot
+ private val notToContainProp: KProperty<*> = Expect>::notToContain
protected val notToContain = notToContainProp.name
protected val value = IterableLikeContains.EntryPointStep, InOrderOnlySearchBehaviour>::value.name
protected val values = IterableLikeContains.EntryPointStep, InOrderOnlySearchBehaviour>::values.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/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 07086ac19..a786f4db4 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,6 +2,7 @@ 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 {
@@ -210,7 +211,7 @@ class AnyExpectationSamples {
notToContain("?")
}
- expect(customers).all {
+ expect(customers).toHaveNextAndAll {
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/ArrayExpectationSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ArrayExpectationSamples.kt
index 27ac909b5..9b3bf3980 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ArrayExpectationSamples.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ArrayExpectationSamples.kt
@@ -26,8 +26,8 @@ class ArrayExpectationSamples {
expect(arrayOf("A", "B"))
.asList {
- contains("C") // fails
- contains("D") // still evaluated, use `.asList().` if you want a fail fast behaviour
+ toContain("C") // fails
+ toContain("D") // still evaluated, use `.asList().` if you want a fail fast behaviour
}
}
}
@@ -45,8 +45,8 @@ class ArrayExpectationSamples {
expect>(arrayOf("A", "B"))
.asList {
- contains("C") // fails
- contains("D") // still evaluated, use `.asList().` if you want a fail fast behaviour
+ toContain("C") // fails
+ toContain("D") // still evaluated, use `.asList().` if you want a fail fast behaviour
}
}
}
@@ -71,8 +71,8 @@ class ArrayExpectationSamples {
expect(byteArrayOf(1, 2, 3))
.asList {
- contains(98) // fails
- contains(99) // still evaluated, use `.asList().` if you want a fail fast behaviour
+ toContain(98) // fails
+ toContain(99) // still evaluated, use `.asList().` if you want a fail fast behaviour
}
}
}
@@ -97,8 +97,8 @@ class ArrayExpectationSamples {
expect(charArrayOf('A', 'B', 'C'))
.asList {
- contains('X') // fails
- contains('Y') // still evaluated, use `.asList().` if you want a fail fast behaviour
+ toContain('X') // fails
+ toContain('Y') // still evaluated, use `.asList().` if you want a fail fast behaviour
}
}
}
@@ -123,8 +123,8 @@ class ArrayExpectationSamples {
expect(shortArrayOf(1, 2, 3))
.asList {
- contains(98) // fails
- contains(99) // still evaluated, use `.asList().` if you want a fail fast behaviour
+ toContain(98) // fails
+ toContain(99) // still evaluated, use `.asList().` if you want a fail fast behaviour
}
}
}
@@ -149,8 +149,8 @@ class ArrayExpectationSamples {
expect(intArrayOf(1, 2, 3))
.asList {
- contains(98) // fails
- contains(99) // still evaluated, use `.asList().` if you want a fail fast behaviour
+ toContain(98) // fails
+ toContain(99) // still evaluated, use `.asList().` if you want a fail fast behaviour
}
}
}
@@ -175,8 +175,8 @@ class ArrayExpectationSamples {
expect(longArrayOf(1L, 2L, 3L))
.asList {
- contains(98L) // fails
- contains(99L) // still evaluated, use `.asList().` if you want a fail fast behaviour
+ toContain(98L) // fails
+ toContain(99L) // still evaluated, use `.asList().` if you want a fail fast behaviour
}
}
}
@@ -201,8 +201,8 @@ class ArrayExpectationSamples {
expect(floatArrayOf(1f, 2f, 3f))
.asList {
- contains(98f) // fails
- contains(99f) // still evaluated, use `.asList().` if you want a fail fast behaviour
+ toContain(98f) // fails
+ toContain(99f) // still evaluated, use `.asList().` if you want a fail fast behaviour
}
}
}
@@ -227,8 +227,8 @@ class ArrayExpectationSamples {
expect(doubleArrayOf(1.1, 2.2, 3.3))
.asList {
- contains(98.1) // fails
- contains(99.2) // still evaluated, use `.asList().` if you want a fail fast behaviour
+ toContain(98.1) // fails
+ toContain(99.2) // still evaluated, use `.asList().` if you want a fail fast behaviour
}
}
}
@@ -254,10 +254,10 @@ class ArrayExpectationSamples {
expect(booleanArrayOf(true, true))
.asList {
// fails
- contains(false)
+ toContain(false)
// still evaluated, use `.asList().` if you want a fail fast behaviour
- contains.inAnyOrder.atLeast(3).value(true)
+ toContain.inAnyOrder.atLeast(3).value(true)
}
}
}
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 9ee4c4079..df89fd2b2 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,6 +6,7 @@ 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 {
@@ -216,7 +217,7 @@ class AnyAssertionSamples {
containsNot("?")
}
- expect(customers).all {
+ expect(customers).toHaveNextAndAll {
because("the legal age of maturity in Switzerland is 18") {
feature { f(it::age) }.isGreaterThanOrEqual(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/MapAssertionSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/MapAssertionSamples.kt
index 575f66086..2ba4d1fc0 100644
--- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/MapAssertionSamples.kt
+++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/MapAssertionSamples.kt
@@ -6,6 +6,7 @@ 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 MapAssertionSamples {
@@ -158,9 +159,11 @@ class MapAssertionSamples {
@Test
fun keysFeature() {
+ // subject inside this block is of type Int
expect(mapOf(1 to "a"))
.keys //subject is of type Set (actually <1>)
- .contains { // subject inside this block is of type Int
+ .toContain {
+ // subject inside this block is of type Int
toBe(1)
}
@@ -190,16 +193,22 @@ class MapAssertionSamples {
@Test
fun valuesFeature() {
+ // subject inside this block is of type String
expect(mapOf(1 to "a"))
.values //subject is of type Collection (actually <"a">)
- .contains { // subject inside this block is of type String
+ .toContain {
+ // subject inside this block is of type String
toBe("a")
}
fails {
- expect(mapOf(1 to "a"))
+ // subject inside this block is of type String
+ expect( // fails because "a" is not equal to "b"
+ mapOf(1 to "a")
+ )
.values //subject is of type Collection (actually <"a">)
- .contains { // subject inside this block is of type String
+ .toContain {
+ // subject inside this block is of type String
toBe("b") // fails because "a" is not equal to "b"
}
}
@@ -222,14 +231,22 @@ class MapAssertionSamples {
@Test
fun asEntriesFeature() {
+ // subject inside this block is of type Map.Entry (actually <1,"a">)
expect(mapOf(1 to "a")).asEntries()
- .contains { // subject inside this block is of type Map.Entry (actually <1,"a">)
+ .toContain {
+ // subject inside this block is of type Map.Entry (actually <1,"a">)
toBe(mapOf(1 to "a").entries.first())
}
fails {
- expect(mapOf(1 to "a")).asEntries()
- .contains { // subject inside this block is of type Map.Entry (actually <1,"a">)
+ // subject inside this block is of type Map.Entry (actually <1,"a">)
+ expect(
+ mapOf(
+ 1 to "a"
+ ) // fails because <1,"a"> is not equal to <1,"b">
+ ).asEntries()
+ .toContain {
+ // subject inside this block is of type Map.Entry (actually <1,"a">)
toBe(mapOf(1 to "b").entries.first()) // fails because <1,"a"> is not equal to <1,"b">
}
}
diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/creating/charsequence/contains/impl/StaticNames.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/creating/charsequence/contains/impl/StaticNames.kt
index bfb8b53ff..58f43397a 100644
--- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/creating/charsequence/contains/impl/StaticNames.kt
+++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/creating/charsequence/contains/impl/StaticNames.kt
@@ -8,6 +8,7 @@ import ch.tutteli.atrium.logic.creating.charsequence.contains.steps.AtLeastCheck
import kotlin.reflect.KFunction2
internal object StaticNames {
+ //TODO rename with 0.18.0 notToContain
val containsNotValuesFun = run {
val f: KFunction2, Values, Expect> =
Expect::notToContain
diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/creating/iterable/contains/impl/StaticNames.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/creating/iterable/contains/impl/StaticNames.kt
index 385203ef6..22b8f171e 100644
--- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/creating/iterable/contains/impl/StaticNames.kt
+++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/creating/iterable/contains/impl/StaticNames.kt
@@ -10,6 +10,7 @@ import ch.tutteli.atrium.logic.creating.iterable.contains.steps.NotCheckerStep
import kotlin.reflect.KFunction2
internal object StaticNames {
+ //TODO rename with 0.18.0 notToContain
val containsNotValuesFun = run {
val containsNotKf: KFunction2>, o, NotCheckerStep, NotSearchBehaviour>> =
Expect>::containsNot
diff --git a/bundles/fluent-en_GB/atrium-fluent-en_GB-js/src/test/kotlin/ch/tutteli/atrium/fluent/en_GB/JsNameAmbiguityTest.kt b/bundles/fluent-en_GB/atrium-fluent-en_GB-js/src/test/kotlin/ch/tutteli/atrium/fluent/en_GB/JsNameAmbiguityTest.kt
index 3e43c3d29..890d9ae54 100644
--- a/bundles/fluent-en_GB/atrium-fluent-en_GB-js/src/test/kotlin/ch/tutteli/atrium/fluent/en_GB/JsNameAmbiguityTest.kt
+++ b/bundles/fluent-en_GB/atrium-fluent-en_GB-js/src/test/kotlin/ch/tutteli/atrium/fluent/en_GB/JsNameAmbiguityTest.kt
@@ -2,6 +2,7 @@ package ch.tutteli.atrium.fluent.en_GB
import ch.tutteli.atrium.api.fluent.en_GB.*
import ch.tutteli.atrium.api.verbs.expect
+import ch.tutteli.atrium.creating.Expect
import kotlin.test.Test
/**
@@ -17,7 +18,7 @@ class JsNameAmbiguityTest {
@Test
fun isKeyValueNullable() {
- expect(mapOf(1 to null as Int?)).asEntries().containsExactly {
+ expect(mapOf(1 to null as Int?)).asEntries().toContainExactly {
isKeyValue(1, null)
}
}
diff --git a/logic/atrium-logic-common/src/test/kotlin/ch/tutteli/atrium/logic/assertions/LazyThreadUnsafeAssertionGroupSpec.kt b/logic/atrium-logic-common/src/test/kotlin/ch/tutteli/atrium/logic/assertions/LazyThreadUnsafeAssertionGroupSpec.kt
index 39cc91289..0dc69bbb0 100644
--- a/logic/atrium-logic-common/src/test/kotlin/ch/tutteli/atrium/logic/assertions/LazyThreadUnsafeAssertionGroupSpec.kt
+++ b/logic/atrium-logic-common/src/test/kotlin/ch/tutteli/atrium/logic/assertions/LazyThreadUnsafeAssertionGroupSpec.kt
@@ -1,6 +1,6 @@
package ch.tutteli.atrium.logic.assertions
-import ch.tutteli.atrium.api.fluent.en_GB.containsExactly
+import ch.tutteli.atrium.api.fluent.en_GB.toContainExactly
import ch.tutteli.atrium.api.fluent.en_GB.toEqual
import ch.tutteli.atrium.api.verbs.internal.expect
import ch.tutteli.atrium.assertions.AssertionGroup
@@ -64,7 +64,7 @@ object LazyThreadUnsafeAssertionGroupSpec : Spek({
}
it("returns the ${AssertionGroup::assertions.name} of the underlying ${AssertionGroup::class.simpleName}") {
- expect(testee.assertions).containsExactly(assertion)
+ expect(testee.assertions).toContainExactly(assertion)
}
}
}
diff --git a/logic/atrium-logic-common/src/test/kotlin/ch/tutteli/atrium/logic/utils/MapArgumentsSpec.kt b/logic/atrium-logic-common/src/test/kotlin/ch/tutteli/atrium/logic/utils/MapArgumentsSpec.kt
index a9a7a7da6..c47865b1f 100644
--- a/logic/atrium-logic-common/src/test/kotlin/ch/tutteli/atrium/logic/utils/MapArgumentsSpec.kt
+++ b/logic/atrium-logic-common/src/test/kotlin/ch/tutteli/atrium/logic/utils/MapArgumentsSpec.kt
@@ -18,7 +18,7 @@ object MapArgumentsSpec : Spek({
expect(it("a", "b", "c"))
.first { toEqual("a.") }
- .second.asList().containsExactly("b.", "c.")
+ .second.asList().toContainExactly("b.", "c.")
}
it("with second step `to`") {
@@ -26,7 +26,7 @@ object MapArgumentsSpec : Spek({
expect(it("a", "b", "c"))
.first { toEqual("a.") }
- .second.asList().containsExactly("b.", "c.")
+ .second.asList().toContainExactly("b.", "c.")
}
it("toExpect") {
@@ -72,7 +72,7 @@ object MapArgumentsSpec : Spek({
expect(it(1, 2, 3, 4))
.first { toEqual(2) }
- .second.asList().containsExactly(3, 4, 5)
+ .second.asList().toContainExactly(3, 4, 5)
}
it("with second step") {
@@ -80,7 +80,7 @@ object MapArgumentsSpec : Spek({
expect(it(1, 2, 3, 4))
.first { toEqual(2) }
- .second.asList().containsExactly(3, 4, 5)
+ .second.asList().toContainExactly(3, 4, 5)
}
}
context("Char") {
@@ -89,14 +89,14 @@ object MapArgumentsSpec : Spek({
expect(it('a', 'b', 'c'))
.first { toEqual('b') }
- .second.asList().containsExactly('c', 'd')
+ .second.asList().toContainExactly('c', 'd')
}
it("with second step") {
fun it(i: Char, vararg iX: Char) = mapArguments(i, iX).to { it + 1 }
expect(it('a', 'b', 'c'))
.first { toEqual('b') }
- .second.asList().containsExactly('c', 'd')
+ .second.asList().toContainExactly('c', 'd')
}
}
context("Short") {
@@ -105,14 +105,14 @@ object MapArgumentsSpec : Spek({
expect(it(1, 2, 3, 4))
.first { toEqual(2) }
- .second.asList().containsExactly(3, 4, 5)
+ .second.asList().toContainExactly(3, 4, 5)
}
it("with second step") {
fun it(i: Short, vararg iX: Short) = mapArguments(i, iX).to { it + 1 }
expect(it(1, 2, 3, 4))
.first { toEqual(2) }
- .second.asList().containsExactly(3, 4, 5)
+ .second.asList().toContainExactly(3, 4, 5)
}
}
context("Int") {
@@ -121,14 +121,14 @@ object MapArgumentsSpec : Spek({
expect(it(1, 2, 3, 4))
.first { toEqual(2) }
- .second.asList().containsExactly(3, 4, 5)
+ .second.asList().toContainExactly(3, 4, 5)
}
it("with second step") {
fun it(i: Int, vararg iX: Int) = mapArguments(i, iX).to { it + 1 }
expect(it(1, 2, 3, 4))
.first { toEqual(2) }
- .second.asList().containsExactly(3, 4, 5)
+ .second.asList().toContainExactly(3, 4, 5)
}
}
context("Long") {
@@ -137,14 +137,14 @@ object MapArgumentsSpec : Spek({
expect(it(1L, 2L, 3L, 4L))
.first { toEqual(2) }
- .second.asList().containsExactly(3, 4, 5)
+ .second.asList().toContainExactly(3, 4, 5)
}
it("with second step") {
fun it(i: Long, vararg iX: Long) = mapArguments(i, iX).to { it + 1 }
expect(it(1L, 2L, 3L, 4L))
.first { toEqual(2) }
- .second.asList().containsExactly(3, 4, 5)
+ .second.asList().toContainExactly(3, 4, 5)
}
}
context("Float") {
@@ -153,14 +153,14 @@ object MapArgumentsSpec : Spek({
expect(it(1f, 2f, 3f, 4f))
.first { toEqual(2f) }
- .second.asList().containsExactly(3f, 4f, 5f)
+ .second.asList().toContainExactly(3f, 4f, 5f)
}
it("with second step") {
fun it(i: Float, vararg iX: Float) = mapArguments(i, iX).to { it + 1 }
expect(it(1f, 2f, 3f, 4f))
.first { toEqual(2f) }
- .second.asList().containsExactly(3f, 4f, 5f)
+ .second.asList().toContainExactly(3f, 4f, 5f)
}
}
context("Double") {
@@ -169,14 +169,14 @@ object MapArgumentsSpec : Spek({
expect(it(1.0, 2.0, 3.0, 4.0))
.first { toEqual(2.0) }
- .second.asList().containsExactly(3.0, 4.0, 5.0)
+ .second.asList().toContainExactly(3.0, 4.0, 5.0)
}
it("with second step") {
fun it(i: Double, vararg iX: Double) = mapArguments(i, iX).to { it + 1 }
expect(it(1.0, 2.0, 3.0, 4.0))
.first { toEqual(2.0) }
- .second.asList().containsExactly(3.0, 4.0, 5.0)
+ .second.asList().toContainExactly(3.0, 4.0, 5.0)
}
}
context("Boolean") {
@@ -185,14 +185,14 @@ object MapArgumentsSpec : Spek({
expect(it(true, false, true))
.first { toEqual(false) }
- .second.asList().containsExactly(true, false)
+ .second.asList().toContainExactly(true, false)
}
it("with second step") {
fun it(i: Boolean, vararg iX: Boolean) = mapArguments(i, iX).to { if (it) "a" else "b" }
expect(it(true, false, false))
.first { toEqual("a") }
- .second.asList().containsExactly("b", "b")
+ .second.asList().toContainExactly("b", "b")
}
}
}
diff --git a/logic/atrium-logic-jvm/src/test/kotlin/ch/tutteli/atrium/logic/impl/creating/filesystem/IoResultSpec.kt b/logic/atrium-logic-jvm/src/test/kotlin/ch/tutteli/atrium/logic/impl/creating/filesystem/IoResultSpec.kt
index 49a9ce03a..79c8759b0 100644
--- a/logic/atrium-logic-jvm/src/test/kotlin/ch/tutteli/atrium/logic/impl/creating/filesystem/IoResultSpec.kt
+++ b/logic/atrium-logic-jvm/src/test/kotlin/ch/tutteli/atrium/logic/impl/creating/filesystem/IoResultSpec.kt
@@ -17,10 +17,10 @@ object IoResultSpec : Spek({
it("creates a Success if the block completes normally") {
val result = testPath.runCatchingIo { "testString" }
- expect(result).toBeAnInstanceOf(fun Expect>.() {
+ expect(result).toBeAnInstanceOf> {
feature(IoResult<*>::path).toEqual(testPath)
feature(Success<*>::value).toEqual("testString")
- })
+ }
}
it("creates a Failure if the block thrown an IOException") {
diff --git a/logic/atrium-logic-jvm/src/test/kotlin/ch/tutteli/atrium/logic/impl/creating/filesystem/hints/SymbolicLinkResolvingSpec.kt b/logic/atrium-logic-jvm/src/test/kotlin/ch/tutteli/atrium/logic/impl/creating/filesystem/hints/SymbolicLinkResolvingSpec.kt
index f70ee3cfe..d8d18f877 100644
--- a/logic/atrium-logic-jvm/src/test/kotlin/ch/tutteli/atrium/logic/impl/creating/filesystem/hints/SymbolicLinkResolvingSpec.kt
+++ b/logic/atrium-logic-jvm/src/test/kotlin/ch/tutteli/atrium/logic/impl/creating/filesystem/hints/SymbolicLinkResolvingSpec.kt
@@ -140,7 +140,7 @@ object SymbolicLinkResolvingSpec : Spek({
val resultAssertion = explainForResolvedLink(link, resolvedPathConsumer)
expect(resultAssertion).toBeAnInstanceOf()
- .feature { p(it::assertions) }.containsExactly(
+ .feature { p(it::assertions) }.toContainExactly(
{ describesLink(link, target) },
{ toBeTheInstance(testAssertion) }
)
@@ -154,7 +154,7 @@ object SymbolicLinkResolvingSpec : Spek({
val resultAssertion = explainForResolvedLink(start, resolvedPathConsumer)
expect(resultAssertion).toBeAnInstanceOf()
- .feature { p(it::assertions) }.containsExactly(
+ .feature { p(it::assertions) }.toContainExactly(
{ describesLink(start, toNowhere) },
{ describesLink(toNowhere, nowhere) },
{ toBeTheInstance(testAssertion) }
@@ -176,7 +176,7 @@ object SymbolicLinkResolvingSpec : Spek({
val resultAssertion = explainForResolvedLink(linkToInnerLink, resolvedPathConsumer)
expect(resultAssertion).toBeAnInstanceOf()
- .feature { p(it::assertions) }.containsExactly(
+ .feature { p(it::assertions) }.toContainExactly(
{ describesLink(linkToInnerLink, innerLinkInGrandparentLink) },
{ describesLink(grandparentLink, grandparent) },
{ describesLink(innerLink, target) },
@@ -192,7 +192,7 @@ object SymbolicLinkResolvingSpec : Spek({
val resultAssertion = explainForResolvedLink(testLink, resolvedPathConsumer)
expect(resultAssertion).toBeAnInstanceOf()
- .feature { p(it::assertions) }.containsExactly(
+ .feature { p(it::assertions) }.toContainExactly(
{ describesLink(barLink, testDir) },
{ describesLink(barLink, testDir) },
{ describesLink(barLink, testDir) },
@@ -209,7 +209,7 @@ object SymbolicLinkResolvingSpec : Spek({
val resultAssertion = explainForResolvedLink(a, resolvedPathConsumer)
expect(resultAssertion).toBeAnInstanceOf()
- .feature { p(it::assertions) }.containsExactly(
+ .feature { p(it::assertions) }.toContainExactly(
{ describesLink(a, b) },
{ describesLink(b, a) },
{ describesLinkLoop(a, b, a) },
@@ -225,7 +225,7 @@ object SymbolicLinkResolvingSpec : Spek({
val resultAssertion = explainForResolvedLink(link, resolvedPathConsumer)
expect(resultAssertion).toBeAnInstanceOf()
- .feature { p(it::assertions) }.containsExactly(
+ .feature { p(it::assertions) }.toContainExactly(
{ describesLink(link, fooLink.resolve("link")) },
{ describesLink(fooLink, foo) },
{ describesLinkLoop(link, link) },
@@ -249,7 +249,7 @@ object SymbolicLinkResolvingSpec : Spek({
val resultAssertion = explainForResolvedLink(linkToInnerLink, resolvedPathConsumer)
expect(resultAssertion).toBeAnInstanceOf()
- .feature { p(it::assertions) }.containsExactly(
+ .feature { p(it::assertions) }.toContainExactly(
{ describesLink(linkToInnerLink, innerLinkInGrandparentLink) },
{ describesLink(grandparentLink, grandparent) },
{ describesLink(innerLink, a) },
@@ -273,7 +273,7 @@ fun Expect.describesLink(link: Path, target: Path) {
fun Expect.describesLinkLoop(vararg loop: Path) {
toBeAnInstanceOf {
- feature { p(it::assertions) }.containsExactly {
+ feature { p(it::assertions) }.toContainExactly {
toBeAnInstanceOf {
val expectedExplanation = TranslatableWithArgs(FAILURE_DUE_TO_LINK_LOOP, loop.joinToString(" -> "))
feature { p(it::explanation) }.toEqual(expectedExplanation)
diff --git a/logic/atrium-logic-jvm/src/test/kotlin/ch/tutteli/atrium/logic/utils/NullableSpec.kt b/logic/atrium-logic-jvm/src/test/kotlin/ch/tutteli/atrium/logic/utils/NullableSpec.kt
index b9614043f..fbfe196f8 100644
--- a/logic/atrium-logic-jvm/src/test/kotlin/ch/tutteli/atrium/logic/utils/NullableSpec.kt
+++ b/logic/atrium-logic-jvm/src/test/kotlin/ch/tutteli/atrium/logic/utils/NullableSpec.kt
@@ -73,22 +73,22 @@ object NullableSpec : Spek({
describeFun(nullableContainerFun.name) {
context("(Mutable)List!") {
it("can be applied to it") {
- expect(nullableContainer(testee.strings)).contains(null)
+ expect(nullableContainer(testee.strings)).toContain(null)
}
it("can be combined with ${nullableFun.name}") {
expect(nullable(nullableContainer(testee.strings))).notToEqualNull {
- contains(null, "hello")
+ toContain(null, "hello")
}
}
}
context("Array!") {
it("can be applied to it") {
- expect(nullableContainer(testee.stringArray)).asList().contains(null)
+ expect(nullableContainer(testee.stringArray)).asList().toContain(null)
}
it("can be combined with ${nullableFun.name}") {
expect(nullable(nullableContainer(testee.stringArray))).notToEqualNull {
- asList().contains(null, "hello")
+ asList().toContain(null, "hello")
}
}
}
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 564feeb43..e3f030538 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
@@ -1,8 +1,8 @@
package ch.tutteli.atrium.specs
-import ch.tutteli.atrium.api.fluent.en_GB.all
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.verbs.internal.expect
import ch.tutteli.atrium.assertions.Assertion
import ch.tutteli.atrium.assertions.AssertionGroup
@@ -55,7 +55,7 @@ abstract class SubjectLessSpec(
}
}
- describe("${groupPrefix}assertion function does not hold if there is no subject") {
+ describe("${groupPrefix}expectation function does not hold if there is no subject") {
assertionCreator.forEach { (name, createAssertion) ->
it("fun `$name`") {
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@@ -63,7 +63,9 @@ abstract class SubjectLessSpec(
val assertions = CollectingExpect(None, expect(1)._logic.components)
.addAssertionsCreatedBy(createAssertion)
.getAssertions()
- expect(assertions).all { feature(Assertion::holds).toEqual(false) }
+ expect(assertions).toHaveNextAndAll {
+ feature(Assertion::holds).toEqual(false)
+ }
}
}
}
diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/ArrayAsListExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/ArrayAsListExpectationsSpec.kt
index 4de52bd0b..1a6040323 100644
--- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/ArrayAsListExpectationsSpec.kt
+++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/ArrayAsListExpectationsSpec.kt
@@ -2,6 +2,8 @@ package ch.tutteli.atrium.specs.integration
import ch.tutteli.atrium.api.fluent.en_GB.contains
import ch.tutteli.atrium.api.fluent.en_GB.containsExactly
+import ch.tutteli.atrium.api.fluent.en_GB.toContain
+import ch.tutteli.atrium.api.fluent.en_GB.toContainExactly
import ch.tutteli.atrium.api.verbs.internal.expect
import ch.tutteli.atrium.creating.Expect
import ch.tutteli.atrium.logic.utils.expectLambda
@@ -36,39 +38,39 @@ abstract class ArrayAsListExpectationsSpec(
val asListWithCreator = "$asListFunName with Creator"
include(object : SubjectLessSpec>("$describePrefix[arr] ",
asListFunName to expectLambda { arr(this) },
- asListWithCreator to expectLambda { arrWithCreator(this) { contains(1) } }
+ asListWithCreator to expectLambda { arrWithCreator(this) { toContain(1) } }
) {})
include(object : SubjectLessSpec("$describePrefix[arrByte] ",
asListFunName to expectLambda { arrByte(this) },
- asListWithCreator to expectLambda { arrByteWithCreator(this) { contains(1) } }
+ asListWithCreator to expectLambda { arrByteWithCreator(this) { toContain(1) } }
) {})
include(object : SubjectLessSpec("$describePrefix[arrChar] ",
asListFunName to expectLambda { arrChar(this) },
- asListWithCreator to expectLambda { arrCharWithCreator(this) { contains('a') } }
+ asListWithCreator to expectLambda { arrCharWithCreator(this) { toContain('a') } }
) {})
include(object : SubjectLessSpec("$describePrefix[arrShort] ",
asListFunName to expectLambda { arrShort(this) },
- asListWithCreator to expectLambda { arrShortWithCreator(this) { contains(1.toShort()) } }
+ asListWithCreator to expectLambda { arrShortWithCreator(this) { toContain(1.toShort()) } }
) {})
include(object : SubjectLessSpec("$describePrefix[arrInt] ",
asListFunName to expectLambda { arrInt(this) },
- asListWithCreator to expectLambda { arrIntWithCreator(this) { contains(1) } }
+ asListWithCreator to expectLambda { arrIntWithCreator(this) { toContain(1) } }
) {})
include(object : SubjectLessSpec("$describePrefix[arrLong] ",
asListFunName to expectLambda { arrLong(this) },
- asListWithCreator to expectLambda { arrLongWithCreator(this) { contains(1L) } }
+ asListWithCreator to expectLambda { arrLongWithCreator(this) { toContain(1L) } }
) {})
include(object : SubjectLessSpec("$describePrefix[arrFloat] ",
asListFunName to expectLambda { arrFloat(this) },
- asListWithCreator to expectLambda { arrFloatWithCreator(this) { contains(1f) } }
+ asListWithCreator to expectLambda { arrFloatWithCreator(this) { toContain(1f) } }
) {})
include(object : SubjectLessSpec("$describePrefix[arrDouble] ",
asListFunName to expectLambda { arrDouble(this) },
- asListWithCreator to expectLambda { arrDoubleWithCreator(this) { contains(1.0) } }
+ asListWithCreator to expectLambda { arrDoubleWithCreator(this) { toContain(1.0) } }
) {})
include(object : SubjectLessSpec("$describePrefix[arrBoolean] ",
asListFunName to expectLambda { arrBoolean(this) },
- asListWithCreator to expectLambda { arrBooleanWithCreator(this) { contains(true) } }
+ asListWithCreator to expectLambda { arrBooleanWithCreator(this) { toContain(true) } }
) {})
fun bytes(vararg bytes: Byte) = bytes
@@ -86,7 +88,7 @@ abstract class ArrayAsListExpectationsSpec(
assertionCreatorSpecTriple(
asListFunName,
anElementWhich,
- { arrWithCreator.invoke(this) { contains(1) } },
+ { arrWithCreator.invoke(this) { toContain(1) } },
{ arrWithCreator.invoke(this) {} })
) {})
include(object : AssertionCreatorSpec(
@@ -94,7 +96,7 @@ abstract class ArrayAsListExpectationsSpec(
assertionCreatorSpecTriple(
asListFunName,
anElementWhich,
- { arrByteWithCreator.invoke(this) { contains(1) } },
+ { arrByteWithCreator.invoke(this) { toContain(1) } },
{ arrByteWithCreator.invoke(this) {} })
) {})
include(object : AssertionCreatorSpec(
@@ -102,7 +104,7 @@ abstract class ArrayAsListExpectationsSpec(
assertionCreatorSpecTriple(
asListFunName,
anElementWhich,
- { arrCharWithCreator.invoke(this) { contains('a') } },
+ { arrCharWithCreator.invoke(this) { toContain('a') } },
{ arrCharWithCreator.invoke(this) {} })
) {})
include(object : AssertionCreatorSpec(
@@ -110,7 +112,7 @@ abstract class ArrayAsListExpectationsSpec(
assertionCreatorSpecTriple(
asListFunName,
anElementWhich,
- { arrShortWithCreator.invoke(this) { contains(1) } },
+ { arrShortWithCreator.invoke(this) { toContain(1) } },
{ arrShortWithCreator.invoke(this) {} })
) {})
include(object : AssertionCreatorSpec(
@@ -118,7 +120,7 @@ abstract class ArrayAsListExpectationsSpec(
assertionCreatorSpecTriple(
asListFunName,
anElementWhich,
- { arrIntWithCreator.invoke(this) { contains(1) } },
+ { arrIntWithCreator.invoke(this) { toContain(1) } },
{ arrIntWithCreator.invoke(this) {} })
) {})
include(object : AssertionCreatorSpec(
@@ -126,7 +128,7 @@ abstract class ArrayAsListExpectationsSpec(
assertionCreatorSpecTriple(
asListFunName,
anElementWhich,
- { arrLongWithCreator.invoke(this) { contains(1) } },
+ { arrLongWithCreator.invoke(this) { toContain(1) } },
{ arrLongWithCreator.invoke(this) {} })
) {})
include(object : AssertionCreatorSpec(
@@ -134,7 +136,7 @@ abstract class ArrayAsListExpectationsSpec(
assertionCreatorSpecTriple(
asListFunName,
anElementWhich,
- { arrFloatWithCreator.invoke(this) { contains(1.0f) } },
+ { arrFloatWithCreator.invoke(this) { toContain(1.0f) } },
{ arrFloatWithCreator.invoke(this) {} })
) {})
include(object : AssertionCreatorSpec(
@@ -142,7 +144,7 @@ abstract class ArrayAsListExpectationsSpec(
assertionCreatorSpecTriple(
asListFunName,
anElementWhich,
- { arrDoubleWithCreator.invoke(this) { contains(1.0) } },
+ { arrDoubleWithCreator.invoke(this) { toContain(1.0) } },
{ arrDoubleWithCreator.invoke(this) {} })
) {})
include(object : AssertionCreatorSpec(
@@ -150,81 +152,81 @@ abstract class ArrayAsListExpectationsSpec(
assertionCreatorSpecTriple(
asListFunName,
anElementWhich,
- { arrBooleanWithCreator.invoke(this) { contains(true) } },
+ { arrBooleanWithCreator.invoke(this) { toContain(true) } },
{ arrBooleanWithCreator.invoke(this) {} })
) {})
describe("$asListFunName arr") {
it("transformation can be applied and a subsequent assertion made") {
- expect(arrayOf(1, 2)).arr().containsExactly(1, 2)
+ expect(arrayOf(1, 2)).arr().toContainExactly(1, 2)
}
it("transformation can be applied and a sub-assertion made") {
- expect(arrayOf(1, 2)).arrWithCreator { containsExactly(1, 2) }
+ expect(arrayOf(1, 2)).arrWithCreator { toContainExactly(1, 2) }
}
}
describe("$asListFunName arrByte") {
it("transformation can be applied and a subsequent assertion made") {
- expect(bytes(1.toByte(), 2.toByte())).arrByte().containsExactly(1.toByte(), 2.toByte())
+ expect(bytes(1.toByte(), 2.toByte())).arrByte().toContainExactly(1.toByte(), 2.toByte())
}
it("transformation can be applied and a sub assertion made") {
- expect(bytes(1.toByte(), 2.toByte())).arrByteWithCreator { containsExactly(1.toByte(), 2.toByte()) }
+ expect(bytes(1.toByte(), 2.toByte())).arrByteWithCreator { toContainExactly(1.toByte(), 2.toByte()) }
}
}
describe("$asListFunName arrChar") {
it("transformation can be applied and a subsequent assertion made") {
- expect(chars(1.toChar(), 2.toChar())).arrChar().containsExactly(1.toChar(), 2.toChar())
+ expect(chars(1.toChar(), 2.toChar())).arrChar().toContainExactly(1.toChar(), 2.toChar())
}
it("transformation can be applied and a sub assertion made") {
- expect(chars(1.toChar(), 2.toChar())).arrCharWithCreator { containsExactly(1.toChar(), 2.toChar()) }
+ expect(chars(1.toChar(), 2.toChar())).arrCharWithCreator { toContainExactly(1.toChar(), 2.toChar()) }
}
}
describe("$asListFunName arrShort") {
it("transformation can be applied and a subsequent assertion made") {
- expect(shorts(1, 2)).arrShort().containsExactly(1.toShort(), 2.toShort())
+ expect(shorts(1, 2)).arrShort().toContainExactly(1.toShort(), 2.toShort())
}
it("transformation can be applied and a sub assertion made") {
- expect(shorts(1, 2)).arrShortWithCreator { containsExactly(1.toShort(), 2.toShort()) }
+ expect(shorts(1, 2)).arrShortWithCreator { toContainExactly(1.toShort(), 2.toShort()) }
}
}
describe("$asListFunName arrInt") {
it("transformation can be applied and a subsequent assertion made") {
- expect(ints(1, 2)).arrInt().containsExactly(1, 2)
+ expect(ints(1, 2)).arrInt().toContainExactly(1, 2)
}
it("transformation can be applied and a sub assertion made") {
- expect(ints(1, 2)).arrIntWithCreator { containsExactly(1, 2) }
+ expect(ints(1, 2)).arrIntWithCreator { toContainExactly(1, 2) }
}
}
describe("$asListFunName arrLong") {
it("transformation can be applied and a subsequent assertion made") {
- expect(longs(1, 2)).arrLong().containsExactly(1L, 2L)
+ expect(longs(1, 2)).arrLong().toContainExactly(1L, 2L)
}
it("transformation can be applied and a sub assertion made") {
- expect(longs(1, 2)).arrLongWithCreator { containsExactly(1L, 2L) }
+ expect(longs(1, 2)).arrLongWithCreator { toContainExactly(1L, 2L) }
}
}
describe("$asListFunName arrFloat") {
it("transformation can be applied and a subsequent assertion made") {
- expect(floats(1f, 2f)).arrFloat().containsExactly(1f, 2f)
+ expect(floats(1f, 2f)).arrFloat().toContainExactly(1f, 2f)
}
it("transformation can be applied and a sub assertion made") {
- expect(floats(1f, 2f)).arrFloatWithCreator { containsExactly(1f, 2f) }
+ expect(floats(1f, 2f)).arrFloatWithCreator { toContainExactly(1f, 2f) }
}
}
describe("$asListFunName arrDouble") {
it("transformation can be applied and a subsequent assertion made") {
- expect(doubles(1.0, 2.0)).arrDouble().containsExactly(1.0, 2.0)
+ expect(doubles(1.0, 2.0)).arrDouble().toContainExactly(1.0, 2.0)
}
it("transformation can be applied and a sub assertion made") {
- expect(doubles(1.0, 2.0)).arrDoubleWithCreator { containsExactly(1.0, 2.0) }
+ expect(doubles(1.0, 2.0)).arrDoubleWithCreator { toContainExactly(1.0, 2.0) }
}
}
describe("$asListFunName arrBoolean") {
it("transformation can be applied and a subsequent assertion made") {
- expect(booleans(true, false)).arrBoolean().containsExactly(true, false)
+ expect(booleans(true, false)).arrBoolean().toContainExactly(true, false)
}
it("transformation can be applied and a sub assertion made") {
- expect(booleans(true, false)).arrBooleanWithCreator { containsExactly(true, false) }
+ expect(booleans(true, false)).arrBooleanWithCreator { toContainExactly(true, false) }
}
}
})
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 c0690f598..2783a0b77 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
@@ -16,7 +16,7 @@ abstract class MapAsEntriesExpectationsSpec(
include(object : SubjectLessSpec