mirror of
https://github.com/jlengrand/atrium.git
synced 2026-03-10 08:01:19 +00:00
Merge pull request #755 from robstoll/remove-deprecated
remove deprecated APIs, bundles, domain/core and part of domain-builders
This commit is contained in:
7
.github/workflows/build-ubuntu.yml
vendored
7
.github/workflows/build-ubuntu.yml
vendored
@@ -20,9 +20,10 @@ jobs:
|
||||
- name: build
|
||||
run: ./gradlew build
|
||||
|
||||
- name: composite build atrium-scala2
|
||||
run: ./gradlew build
|
||||
working-directory: misc/tools/atrium-scala2-test
|
||||
# TODO 0.16.0 or 0.17.0 re-activate scala API
|
||||
# - name: composite build atrium-scala2
|
||||
# run: ./gradlew build
|
||||
# working-directory: misc/tools/atrium-scala2-test
|
||||
|
||||
- name: Upload windows build code coverage
|
||||
uses: codecov/codecov-action@v1
|
||||
|
||||
7
.github/workflows/build-windows.yml
vendored
7
.github/workflows/build-windows.yml
vendored
@@ -47,9 +47,10 @@ jobs:
|
||||
run: ATRIUM_ANDROID_JAR="$PWD/android-jar-cache/android.jar" ./gradlew checkDexer
|
||||
shell: bash
|
||||
|
||||
- name: composite build atrium-scala2
|
||||
run: ./gradlew build
|
||||
working-directory: misc\tools\atrium-scala2-test
|
||||
# TODO 0.16.0 or 0.17.0 re-activate scala API
|
||||
# - name: composite build atrium-scala2
|
||||
# run: ./gradlew build
|
||||
# working-directory: misc\tools\atrium-scala2-test
|
||||
|
||||
- name: Upload windows build code coverage
|
||||
uses: codecov/codecov-action@v1
|
||||
|
||||
144
README.md
144
README.md
@@ -271,7 +271,7 @@ import ch.tutteli.atrium.api.verbs.expect
|
||||
val x = 10
|
||||
expect(x).toBe(9)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L53)</sub> ↓ <sub>[Output](#ex-first)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L54)</sub> ↓ <sub>[Output](#ex-first)</sub>
|
||||
<a name="ex-first"></a>
|
||||
```text
|
||||
expected that subject: 10 (kotlin.Int <1234789>)
|
||||
@@ -314,7 +314,7 @@ The next section shows how you can define multiple assertions for the same subje
|
||||
// two single assertions, only first evaluated
|
||||
expect(4 + 6).isLessThan(5).isGreaterThan(10)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L60)</sub> ↓ <sub>[Output](#ex-single)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L61)</sub> ↓ <sub>[Output](#ex-single)</sub>
|
||||
<a name="ex-single"></a>
|
||||
```text
|
||||
expected that subject: 10 (kotlin.Int <1234789>)
|
||||
@@ -347,7 +347,7 @@ expect(4 + 6) {
|
||||
isGreaterThan(10)
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L65)</sub> ↓ <sub>[Output](#ex-group)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L66)</sub> ↓ <sub>[Output](#ex-group)</sub>
|
||||
<a name="ex-group"></a>
|
||||
```text
|
||||
expected that subject: 10 (kotlin.Int <1234789>)
|
||||
@@ -379,7 +379,7 @@ expect {
|
||||
throw IllegalArgumentException("name is empty")
|
||||
}.toThrow<IllegalStateException>()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L73)</sub> ↓ <sub>[Output](#ex-toThrow1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L74)</sub> ↓ <sub>[Output](#ex-toThrow1)</sub>
|
||||
<a name="ex-toThrow1"></a>
|
||||
```text
|
||||
expected that subject: () -> kotlin.Nothing (readme.examples.ReadmeSpec$1$4$1 <1234789>)
|
||||
@@ -388,10 +388,10 @@ expected that subject: () -> kotlin.Nothing (readme.examples.ReadmeSpec$1
|
||||
ℹ Properties of the unexpected IllegalArgumentException
|
||||
» message: "name is empty" <1234789>
|
||||
» stacktrace:
|
||||
⚬ readme.examples.ReadmeSpec$1$4$1.invoke(ReadmeSpec.kt:76)
|
||||
⚬ readme.examples.ReadmeSpec$1$4$1.invoke(ReadmeSpec.kt:51)
|
||||
⚬ readme.examples.ReadmeSpec$1$4.invoke(ReadmeSpec.kt:691)
|
||||
⚬ readme.examples.ReadmeSpec$1$4.invoke(ReadmeSpec.kt:51)
|
||||
⚬ readme.examples.ReadmeSpec$1$4$1.invoke(ReadmeSpec.kt:77)
|
||||
⚬ readme.examples.ReadmeSpec$1$4$1.invoke(ReadmeSpec.kt:52)
|
||||
⚬ readme.examples.ReadmeSpec$1$4.invoke(ReadmeSpec.kt:662)
|
||||
⚬ readme.examples.ReadmeSpec$1$4.invoke(ReadmeSpec.kt:52)
|
||||
```
|
||||
</ex-toThrow1>
|
||||
|
||||
@@ -415,7 +415,7 @@ expect {
|
||||
throw IllegalArgumentException()
|
||||
}.toThrow<IllegalArgumentException>().message.startsWith("firstName")
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L80)</sub> ↓ <sub>[Output](#ex-toThrow2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L81)</sub> ↓ <sub>[Output](#ex-toThrow2)</sub>
|
||||
<a name="ex-toThrow2"></a>
|
||||
```text
|
||||
expected that subject: () -> kotlin.Nothing (readme.examples.ReadmeSpec$1$5$1 <1234789>)
|
||||
@@ -436,7 +436,7 @@ expect {
|
||||
message { startsWith("firstName") }
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L86)</sub> ↓ <sub>[Output](#ex-toThrow3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L87)</sub> ↓ <sub>[Output](#ex-toThrow3)</sub>
|
||||
<a name="ex-toThrow3"></a>
|
||||
```text
|
||||
expected that subject: () -> kotlin.Nothing (readme.examples.ReadmeSpec$1$6$1 <1234789>)
|
||||
@@ -460,7 +460,7 @@ expect {
|
||||
throw IllegalArgumentException("name is empty", RuntimeException("a cause"))
|
||||
}.notToThrow()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L94)</sub> ↓ <sub>[Output](#ex-notToThrow)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L95)</sub> ↓ <sub>[Output](#ex-notToThrow)</sub>
|
||||
<a name="ex-notToThrow"></a>
|
||||
```text
|
||||
expected that subject: () -> kotlin.Nothing (readme.examples.ReadmeSpec$1$7$1 <1234789>)
|
||||
@@ -468,14 +468,14 @@ expected that subject: () -> kotlin.Nothing (readme.examples.ReadmeSpec$1
|
||||
ℹ Properties of the unexpected IllegalArgumentException
|
||||
» message: "name is empty" <1234789>
|
||||
» stacktrace:
|
||||
⚬ readme.examples.ReadmeSpec$1$7$1.invoke(ReadmeSpec.kt:97)
|
||||
⚬ readme.examples.ReadmeSpec$1$7$1.invoke(ReadmeSpec.kt:51)
|
||||
⚬ readme.examples.ReadmeSpec$1$7.invoke(ReadmeSpec.kt:98)
|
||||
⚬ readme.examples.ReadmeSpec$1$7.invoke(ReadmeSpec.kt:51)
|
||||
⚬ readme.examples.ReadmeSpec$1$7$1.invoke(ReadmeSpec.kt:98)
|
||||
⚬ readme.examples.ReadmeSpec$1$7$1.invoke(ReadmeSpec.kt:52)
|
||||
⚬ readme.examples.ReadmeSpec$1$7.invoke(ReadmeSpec.kt:99)
|
||||
⚬ readme.examples.ReadmeSpec$1$7.invoke(ReadmeSpec.kt:52)
|
||||
» cause: java.lang.RuntimeException
|
||||
» message: "a cause" <1234789>
|
||||
» stacktrace:
|
||||
⚬ readme.examples.ReadmeSpec$1$7$1.invoke(ReadmeSpec.kt:97)
|
||||
⚬ readme.examples.ReadmeSpec$1$7$1.invoke(ReadmeSpec.kt:98)
|
||||
```
|
||||
</ex-notToThrow>
|
||||
|
||||
@@ -514,7 +514,7 @@ expect(myPerson)
|
||||
.feature { f(it::fullName) } // not evaluated anymore, subject String afterwards
|
||||
.startsWith("rob") // not evaluated anymore
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L113)</sub> ↓ <sub>[Output](#ex-property-methods-single)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L114)</sub> ↓ <sub>[Output](#ex-property-methods-single)</sub>
|
||||
<a name="ex-property-methods-single"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Robert, lastName=Stoll, isStudent=false) (readme.examples.ReadmeSpec$1$Person <1234789>)
|
||||
@@ -567,7 +567,7 @@ Feature assertions follow the common pattern of having two overloads:
|
||||
feature { f(it::lastName) }.toBe("Dummy")
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L122)</sub> ↓ <sub>[Output](#ex-property-methods-group)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L123)</sub> ↓ <sub>[Output](#ex-property-methods-group)</sub>
|
||||
<a name="ex-property-methods-group"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Robert, lastName=Stoll, isStudent=false) (readme.examples.ReadmeSpec$1$Person <1234789>)
|
||||
@@ -618,7 +618,7 @@ expect(myPerson)
|
||||
.toBe("Robert aka. Stoll") // fails
|
||||
.startsWith("llotS") // not evaluated anymore
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L136)</sub> ↓ <sub>[Output](#ex-methods-args)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L137)</sub> ↓ <sub>[Output](#ex-methods-args)</sub>
|
||||
<a name="ex-methods-args"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Robert, lastName=Stoll, isStudent=false) (readme.examples.ReadmeSpec$1$Person <1234789>)
|
||||
@@ -671,7 +671,7 @@ expect(myFamily)
|
||||
.feature("first member's name") { members.first().name } // subject narrowed to String
|
||||
.toBe("Peter")
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L153)</sub> ↓ <sub>[Output](#ex-arbitrary-features)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L154)</sub> ↓ <sub>[Output](#ex-arbitrary-features)</sub>
|
||||
<a name="ex-arbitrary-features"></a>
|
||||
```text
|
||||
expected that subject: Family(members=[FamilyMember(name=Robert)]) (readme.examples.ReadmeSpec$1$Family <1234789>)
|
||||
@@ -718,7 +718,7 @@ expect(listOf(1 to "a", 2 to "b")).get(10) {
|
||||
firstToBe(1)
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L169)</sub> ↓ <sub>[Output](#ex-within-assertion-functions)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L170)</sub> ↓ <sub>[Output](#ex-within-assertion-functions)</sub>
|
||||
<a name="ex-within-assertion-functions"></a>
|
||||
```text
|
||||
expected that subject: [(1, a), (2, b)] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -805,7 +805,7 @@ expect(x).isA<SubType1>()
|
||||
.feature { f(it::number) }
|
||||
.toBe(2)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L202)</sub> ↓ <sub>[Output](#ex-type-assertions-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L203)</sub> ↓ <sub>[Output](#ex-type-assertions-1)</sub>
|
||||
<a name="ex-type-assertions-1"></a>
|
||||
```text
|
||||
expected that subject: SubType2(word=hello, flag=true) (readme.examples.SubType2 <1234789>)
|
||||
@@ -827,7 +827,7 @@ expect(x).isA<SubType2> {
|
||||
feature { f(it::flag) }.toBe(false)
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L208)</sub> ↓ <sub>[Output](#ex-type-assertions-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L209)</sub> ↓ <sub>[Output](#ex-type-assertions-2)</sub>
|
||||
<a name="ex-type-assertions-2"></a>
|
||||
```text
|
||||
expected that subject: SubType2(word=hello, flag=true) (readme.examples.SubType2 <1234789>)
|
||||
@@ -856,7 +856,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).toBe(null)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L234)</sub> ↓ <sub>[Output](#ex-nullable-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L235)</sub> ↓ <sub>[Output](#ex-nullable-1)</sub>
|
||||
<a name="ex-nullable-1"></a>
|
||||
```text
|
||||
expected that subject: "postulating assertions made easy" <1234789>
|
||||
@@ -870,7 +870,7 @@ expected that subject: "postulating assertions made easy" <1234789>
|
||||
val slogan2: String? = null
|
||||
expect(slogan2).toBe("postulating assertions made easy")
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L238)</sub> ↓ <sub>[Output](#ex-nullable-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L239)</sub> ↓ <sub>[Output](#ex-nullable-2)</sub>
|
||||
<a name="ex-nullable-2"></a>
|
||||
```text
|
||||
expected that subject: null
|
||||
@@ -891,7 +891,7 @@ expect(slogan2) // subject has type String?
|
||||
.notToBeNull() // subject narrowed to String
|
||||
.startsWith("atrium")
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L243)</sub> ↓ <sub>[Output](#ex-nullable-3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L244)</sub> ↓ <sub>[Output](#ex-nullable-3)</sub>
|
||||
<a name="ex-nullable-3"></a>
|
||||
```text
|
||||
expected that subject: null
|
||||
@@ -908,7 +908,7 @@ one without (example above) and one with `assertionCreator`-lambda (example belo
|
||||
```kotlin
|
||||
expect(slogan2).notToBeNull { startsWith("atrium") }
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L248)</sub> ↓ <sub>[Output](#ex-nullable-4)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L249)</sub> ↓ <sub>[Output](#ex-nullable-4)</sub>
|
||||
<a name="ex-nullable-4"></a>
|
||||
```text
|
||||
expected that subject: null
|
||||
@@ -944,7 +944,7 @@ The following sub sections show both use cases by examples.
|
||||
```kotlin
|
||||
expect(listOf(1, 2, 2, 4)).contains(2, 3)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L252)</sub> ↓ <sub>[Output](#ex-collection-short-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L253)</sub> ↓ <sub>[Output](#ex-collection-short-1)</sub>
|
||||
<a name="ex-collection-short-1"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -985,7 +985,7 @@ expect(listOf(1, 2, 2, 4)).contains(
|
||||
{ isGreaterThan(2).isLessThan(4) }
|
||||
)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L256)</sub> ↓ <sub>[Output](#ex-collection-short-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L257)</sub> ↓ <sub>[Output](#ex-collection-short-2)</sub>
|
||||
<a name="ex-collection-short-2"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1025,7 +1025,7 @@ Following each in action:
|
||||
```kotlin
|
||||
expect(listOf(1, 2, 3, 4)).any { isLessThan(0) }
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L263)</sub> ↓ <sub>[Output](#ex-collection-any)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L264)</sub> ↓ <sub>[Output](#ex-collection-any)</sub>
|
||||
<a name="ex-collection-any"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1042,7 +1042,7 @@ expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>
|
||||
```kotlin
|
||||
expect(listOf(1, 2, 3, 4)).none { isGreaterThan(2) }
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L266)</sub> ↓ <sub>[Output](#ex-collection-none)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L267)</sub> ↓ <sub>[Output](#ex-collection-none)</sub>
|
||||
<a name="ex-collection-none"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1061,7 +1061,7 @@ expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>
|
||||
```kotlin
|
||||
expect(listOf(1, 2, 3, 4)).all { isGreaterThan(2) }
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L269)</sub> ↓ <sub>[Output](#ex-collection-all)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L270)</sub> ↓ <sub>[Output](#ex-collection-all)</sub>
|
||||
<a name="ex-collection-all"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1091,7 +1091,7 @@ Following on the last section we will start with an `inOrder` example:
|
||||
```kotlin
|
||||
expect(listOf(1, 2, 2, 4)).contains.inOrder.only.entries({ isLessThan(3) }, { isLessThan(2) })
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L273)</sub> ↓ <sub>[Output](#ex-collection-builder-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L274)</sub> ↓ <sub>[Output](#ex-collection-builder-1)</sub>
|
||||
<a name="ex-collection-builder-1"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1139,7 +1139,7 @@ and we happily answer your question there.
|
||||
```kotlin
|
||||
expect(listOf(1, 2, 2, 4)).contains.inOrder.only.values(1, 2, 2, 3, 4)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L276)</sub> ↓ <sub>[Output](#ex-collection-builder-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L277)</sub> ↓ <sub>[Output](#ex-collection-builder-2)</sub>
|
||||
<a name="ex-collection-builder-2"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1164,7 +1164,7 @@ 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({ isLessThan(3) })
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L279)</sub> ↓ <sub>[Output](#ex-collection-builder-3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L280)</sub> ↓ <sub>[Output](#ex-collection-builder-3)</sub>
|
||||
<a name="ex-collection-builder-3"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1181,7 +1181,7 @@ 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)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L282)</sub> ↓ <sub>[Output](#ex-collection-builder-4)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L283)</sub> ↓ <sub>[Output](#ex-collection-builder-4)</sub>
|
||||
<a name="ex-collection-builder-4"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1202,7 +1202,7 @@ 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)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L285)</sub> ↓ <sub>[Output](#ex-collection-builder-5)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L286)</sub> ↓ <sub>[Output](#ex-collection-builder-5)</sub>
|
||||
<a name="ex-collection-builder-5"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1232,7 +1232,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)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L289)</sub> ↓ <sub>[Output](#ex-map-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L290)</sub> ↓ <sub>[Output](#ex-map-1)</sub>
|
||||
<a name="ex-map-1"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1256,7 +1256,7 @@ expect(mapOf("a" to 1, "b" to 2)).contains(
|
||||
KeyValue("b") { isLessThan(2) }
|
||||
)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L292)</sub> ↓ <sub>[Output](#ex-map-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L293)</sub> ↓ <sub>[Output](#ex-map-2)</sub>
|
||||
<a name="ex-map-2"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1278,7 +1278,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)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L300)</sub> ↓ <sub>[Output](#ex-map-only-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L301)</sub> ↓ <sub>[Output](#ex-map-only-1)</sub>
|
||||
<a name="ex-map-only-1"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1303,7 +1303,7 @@ expect(mapOf("a" to 1, "b" to 2)).containsOnly(
|
||||
KeyValue("b") { isLessThan(2) }
|
||||
)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L303)</sub> ↓ <sub>[Output](#ex-map-only-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L304)</sub> ↓ <sub>[Output](#ex-map-only-2)</sub>
|
||||
<a name="ex-map-only-2"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1331,7 +1331,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)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L311)</sub> ↓ <sub>[Output](#ex-map-builder-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L312)</sub> ↓ <sub>[Output](#ex-map-builder-1)</sub>
|
||||
<a name="ex-map-builder-1"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1360,7 +1360,7 @@ expect(mapOf("a" to 1, "b" to 2)).contains.inOrder.only.entries(
|
||||
KeyValue("a") { isLessThan(2) },
|
||||
KeyValue("b") { isLessThan(2) })
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L314)</sub> ↓ <sub>[Output](#ex-map-builder-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L315)</sub> ↓ <sub>[Output](#ex-map-builder-2)</sub>
|
||||
<a name="ex-map-builder-2"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1399,7 +1399,7 @@ expect(mapOf("bernstein" to bernstein))
|
||||
feature { f(it::firstName) }.toBe("Albert")
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L324)</sub> ↓ <sub>[Output](#ex-map-3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L325)</sub> ↓ <sub>[Output](#ex-map-3)</sub>
|
||||
<a name="ex-map-3"></a>
|
||||
```text
|
||||
expected that subject: {bernstein=Person(firstName=Leonard, lastName=Bernstein, age=50)} (java.util.Collections.SingletonMap <1234789>)
|
||||
@@ -1419,7 +1419,7 @@ expect(mapOf("a" to 1, "b" to 2)) {
|
||||
values { none { isGreaterThan(1) } }
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L336)</sub> ↓ <sub>[Output](#ex-map-4)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L337)</sub> ↓ <sub>[Output](#ex-map-4)</sub>
|
||||
<a name="ex-map-4"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1457,7 +1457,7 @@ expect(linkedMapOf("a" to 1, "b" to 2)).asEntries().contains.inOrder.only.entrie
|
||||
}
|
||||
)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L342)</sub> ↓ <sub>[Output](#ex-map-5)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L343)</sub> ↓ <sub>[Output](#ex-map-5)</sub>
|
||||
<a name="ex-map-5"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1492,7 +1492,7 @@ For example, `exists` will explain which entry was the first one missing:
|
||||
```kotlin
|
||||
expect(Paths.get("/usr/bin/noprogram")).exists()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L352)</sub> ↓ <sub>[Output](#ex-path-exists)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L353)</sub> ↓ <sub>[Output](#ex-path-exists)</sub>
|
||||
<a name="ex-path-exists"></a>
|
||||
```text
|
||||
expected that subject: /usr/bin/noprogram (sun.nio.fs.UnixPath <1234789>)
|
||||
@@ -1508,7 +1508,7 @@ Atrium will give details about why something cannot be accessed, for example whe
|
||||
```kotlin
|
||||
expect(Paths.get("/root/.ssh/config")).isWritable()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L356)</sub> ↓ <sub>[Output](#ex-path-writable)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L357)</sub> ↓ <sub>[Output](#ex-path-writable)</sub>
|
||||
<a name="ex-path-writable"></a>
|
||||
```text
|
||||
expected that subject: /root/.ssh/config (sun.nio.fs.UnixPath <1234789>)
|
||||
@@ -1531,9 +1531,8 @@ val filePointer = Files.createSymbolicLink(directory.resolve("directory"), file)
|
||||
|
||||
expect(filePointer.resolve("subfolder/file")).isRegularFile()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L361)</sub> ↓ <sub>[Output](#ex-path-symlink-and-parent-not-folder)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L362)</sub> ↓ <sub>[Output](#ex-path-symlink-and-parent-not-folder)</sub>
|
||||
<a name="ex-path-symlink-and-parent-not-folder"></a>
|
||||
|
||||
```text
|
||||
expected that subject: /tmp/atrium-path/directory/subfolder/file (sun.nio.fs.UnixPath <1234789>)
|
||||
◆ is: a file
|
||||
@@ -1541,7 +1540,6 @@ expected that subject: /tmp/atrium-path/directory/subfolder/file (sun.nio
|
||||
» failure at parent path: /tmp/atrium-path/file (sun.nio.fs.UnixPath <1234789>)
|
||||
» was a file instead of a directory
|
||||
```
|
||||
|
||||
</ex-path-symlink-and-parent-not-folder>
|
||||
|
||||
## Attaching a Reason
|
||||
@@ -1557,9 +1555,7 @@ expect("filename?")
|
||||
containsNot("?")
|
||||
}
|
||||
```
|
||||
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L370)</sub>
|
||||
↓ <sub>[Output](#ex-because-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L371)</sub> ↓ <sub>[Output](#ex-because-1)</sub>
|
||||
<a name="ex-because-1"></a>
|
||||
```text
|
||||
expected that subject: "filename?" <1234789>
|
||||
@@ -1614,7 +1610,7 @@ expect("calling myFun with...") {
|
||||
}
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L411)</sub> ↓ <sub>[Output](#ex-data-driven-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L382)</sub> ↓ <sub>[Output](#ex-data-driven-1)</sub>
|
||||
<a name="ex-data-driven-1"></a>
|
||||
```text
|
||||
expected that subject: "calling myFun with..." <1234789>
|
||||
@@ -1649,7 +1645,7 @@ expect("calling myFun with ...") {
|
||||
}
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L425)</sub> ↓ <sub>[Output](#ex-data-driven-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L396)</sub> ↓ <sub>[Output](#ex-data-driven-2)</sub>
|
||||
<a name="ex-data-driven-2"></a>
|
||||
```text
|
||||
expected that subject: "calling myFun with ..." <1234789>
|
||||
@@ -1690,7 +1686,7 @@ expect("calling myNullableFun with ...") {
|
||||
}
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L443)</sub> ↓ <sub>[Output](#ex-data-driven-3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L414)</sub> ↓ <sub>[Output](#ex-data-driven-3)</sub>
|
||||
<a name="ex-data-driven-3"></a>
|
||||
```text
|
||||
expected that subject: "calling myNullableFun with ..." <1234789>
|
||||
@@ -1836,10 +1832,10 @@ expect {
|
||||
}
|
||||
}.toThrow<IllegalStateException> { messageContains("no no no") }
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L467)</sub> ↓ <sub>[Output](#ex-add-info-3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L438)</sub> ↓ <sub>[Output](#ex-add-info-3)</sub>
|
||||
<a name="ex-add-info-3"></a>
|
||||
```text
|
||||
expected that subject: () -> kotlin.Nothing (readme.examples.ReadmeSpec2$1$42$1 <1234789>)
|
||||
expected that subject: () -> kotlin.Nothing (readme.examples.ReadmeSpec2$1$36$1 <1234789>)
|
||||
◆ ▶ thrown exception when called: java.lang.IllegalArgumentException
|
||||
◾ is instance of type: IllegalStateException (java.lang.IllegalStateException)
|
||||
» ▶ message:
|
||||
@@ -1851,14 +1847,14 @@ expected that subject: () -> kotlin.Nothing (readme.examples.ReadmeSpec2$
|
||||
ℹ Properties of the unexpected IllegalArgumentException
|
||||
» message: "no no no..." <1234789>
|
||||
» stacktrace:
|
||||
⚬ readme.examples.ReadmeSpec2$1$42$1.invoke(ReadmeSpec.kt:472)
|
||||
⚬ readme.examples.ReadmeSpec2$1$42$1.invoke(ReadmeSpec.kt:227)
|
||||
⚬ readme.examples.ReadmeSpec2$1$42.invoke(ReadmeSpec.kt:691)
|
||||
⚬ readme.examples.ReadmeSpec2$1$42.invoke(ReadmeSpec.kt:227)
|
||||
⚬ readme.examples.ReadmeSpec2$1$36$1.invoke(ReadmeSpec.kt:443)
|
||||
⚬ readme.examples.ReadmeSpec2$1$36$1.invoke(ReadmeSpec.kt:228)
|
||||
⚬ readme.examples.ReadmeSpec2$1$36.invoke(ReadmeSpec.kt:662)
|
||||
⚬ readme.examples.ReadmeSpec2$1$36.invoke(ReadmeSpec.kt:228)
|
||||
» cause: java.lang.UnsupportedOperationException
|
||||
» message: "not supported" <1234789>
|
||||
» stacktrace:
|
||||
⚬ readme.examples.ReadmeSpec2$1$42$1.invoke(ReadmeSpec.kt:470)
|
||||
⚬ readme.examples.ReadmeSpec2$1$36$1.invoke(ReadmeSpec.kt:441)
|
||||
```
|
||||
</ex-add-info-3>
|
||||
|
||||
@@ -1879,7 +1875,7 @@ then Atrium reminds us of the possible pitfall. For instance:
|
||||
```kotlin
|
||||
expect(BigDecimal.TEN).isEqualIncludingScale(BigDecimal("10.0"))
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L477)</sub> ↓ <sub>[Output](#ex-pitfall-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L448)</sub> ↓ <sub>[Output](#ex-pitfall-1)</sub>
|
||||
<a name="ex-pitfall-1"></a>
|
||||
```text
|
||||
expected that subject: 10 (java.math.BigDecimal <1234789>)
|
||||
@@ -1897,7 +1893,7 @@ For instance:
|
||||
```kotlin
|
||||
expect(listOf(1)).get(0) {}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L480)</sub> ↓ <sub>[Output](#ex-pitfall-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L451)</sub> ↓ <sub>[Output](#ex-pitfall-2)</sub>
|
||||
<a name="ex-pitfall-2"></a>
|
||||
```text
|
||||
expected that subject: [1] (java.util.Collections.SingletonList <1234789>)
|
||||
@@ -1974,7 +1970,7 @@ and its usage:
|
||||
```kotlin
|
||||
expect(12).isMultipleOf(5)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L492)</sub> ↓ <sub>[Output](#ex-own-boolean-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L463)</sub> ↓ <sub>[Output](#ex-own-boolean-1)</sub>
|
||||
<a name="ex-own-boolean-1"></a>
|
||||
```text
|
||||
expected that subject: 12 (kotlin.Int <1234789>)
|
||||
@@ -2024,7 +2020,7 @@ Its usage looks then as follows:
|
||||
```kotlin
|
||||
expect(13).isEven()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L503)</sub> ↓ <sub>[Output](#ex-own-boolean-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L474)</sub> ↓ <sub>[Output](#ex-own-boolean-2)</sub>
|
||||
<a name="ex-own-boolean-2"></a>
|
||||
```text
|
||||
expected that subject: 13 (kotlin.Int <1234789>)
|
||||
@@ -2123,7 +2119,7 @@ Its usage is then as follows:
|
||||
expect(Person("Susanne", "Whitley", 43, listOf()))
|
||||
.hasNumberOfChildren(2)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L542)</sub> ↓ <sub>[Output](#ex-own-compose-3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L513)</sub> ↓ <sub>[Output](#ex-own-compose-3)</sub>
|
||||
<a name="ex-own-compose-3"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[]) (readme.examples.Person <1234789>)
|
||||
@@ -2157,7 +2153,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()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L557)</sub> ↓ <sub>[Output](#ex-own-compose-4)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L528)</sub> ↓ <sub>[Output](#ex-own-compose-4)</sub>
|
||||
<a name="ex-own-compose-4"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[]) (readme.examples.Person <1234789>)
|
||||
@@ -2199,7 +2195,7 @@ expect(Person("Susanne", "Whitley", 43, listOf(Person("Petra", "Whitley", 12, li
|
||||
.children // using the val -> subsequent assertions are about children and fail fast
|
||||
.hasSize(2)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L567)</sub> ↓ <sub>[Output](#ex-own-compose-5)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/ReadmeSpec.kt#L538)</sub> ↓ <sub>[Output](#ex-own-compose-5)</sub>
|
||||
<a name="ex-own-compose-5"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[Person(firstName=Petra, lastName=Whitley, age=12, children=[])]) (readme.examples.Person <1234789>)
|
||||
@@ -2620,12 +2616,6 @@ Atrium provides KDoc for all APIs - have a look at their KDoc:
|
||||
- [atrium-api-fluent-en_GB](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.fluent.en_-g-b/index.html)
|
||||
- [atrium-api-infix-en_GB](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.infix.en_-g-b/index.html)
|
||||
|
||||
Deprecated APIs:
|
||||
- [atrium-api-cc-en_GB](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.cc.en_-g-b/index.html)
|
||||
- [atrium-api-cc-en_UK](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.cc.en_-u-k/index.html)
|
||||
- [atrium-api-cc-de_CH](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.cc.de_-d-e/index.html)
|
||||
- [atrium-api-cc-infix-en_GB](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.cc.infix.en_-g-b/index.html)
|
||||
|
||||
## Problems in conjunction with `feature`
|
||||
|
||||
See [Ambiguity Problems](#ambiguity-problems) and [Property does not exist](#property-does-not-exist).
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceAssertionsKt")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.NotCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl.NotCheckerOptionImpl
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains.Builder
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.NoOpSearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.NotSearchBehaviour
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Creates a [CharSequenceContains.Builder] based on this [Expect] which allows to define
|
||||
* more sophisticated `contains` assertions.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
@Deprecated("Only here to retain binary backward compatibility; will be removed with 1.0.0")
|
||||
fun <T : CharSequence> getContains(expect: Expect<T>): Builder<T, NoOpSearchBehaviour> =
|
||||
ExpectImpl.charSequence.containsBuilder(expect)
|
||||
|
||||
/**
|
||||
* Creates a [CharSequenceContains.Builder] based on this [Expect] which allows to define
|
||||
* more sophisticated `contains not` assertions.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
@Deprecated("Only here to retain binary backward compatibility; will be removed with 1.0.0")
|
||||
fun <T : CharSequence> getContainsNot(expect: Expect<T>): NotCheckerOption<T, NotSearchBehaviour> =
|
||||
NotCheckerOptionImpl(ExpectImpl.charSequence.containsNotBuilder(expect))
|
||||
@@ -1,97 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceContainsCheckersKt")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.*
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl.*
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains.SearchBehaviour
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the value which we are looking
|
||||
* for occurs `at least` number of [times] within the search input.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected value is
|
||||
* found in the input of the search.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.Builder<T, S>.atLeast(
|
||||
times: Int
|
||||
): AtLeastCheckerOption<T, S> = AtLeastCheckerOptionImpl(times, this)
|
||||
|
||||
/**
|
||||
* Restricts a `contains at least` assertion by specifying that the number of occurrences of the value which we
|
||||
* are looking for occurs `at most` number of [times] within the search input.
|
||||
*
|
||||
* The resulting restriction will be a `contains at least but at most` assertion.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected value is
|
||||
* found in the input of the search.
|
||||
*
|
||||
* @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] of this `at most` restriction equals to the number of the
|
||||
* `at least` restriction; use the [exactly] restriction instead.
|
||||
*/
|
||||
fun <T : CharSequence, S : SearchBehaviour> AtLeastCheckerOption<T, S>.butAtMost(
|
||||
times: Int
|
||||
): ButAtMostCheckerOption<T, S> = ButAtMostCheckerOptionImpl(times, this, containsBuilder)
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the value which we
|
||||
* are looking for occurs `exactly` number of [times] within the search input.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected value is
|
||||
* found in the input of the search.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.Builder<T, S>.exactly(
|
||||
times: Int
|
||||
): ExactlyCheckerOption<T, S> = ExactlyCheckerOptionImpl(times, this)
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the value which we
|
||||
* are looking for occurs `at least` once but `at most` number of [times] within the search input.
|
||||
*
|
||||
* If you want to use a higher lower bound than one, then use `atLeast(2).butAtMost(3)` instead of `atMost(3)`.
|
||||
* And in case you want to state that it is either not contained at all or at most a certain number of times,
|
||||
* then use `notOrAtMost(2)` instead.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected value is
|
||||
* found in the input of the search.
|
||||
*
|
||||
* @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 one; use [exactly] instead.
|
||||
*/
|
||||
fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.Builder<T, S>.atMost(
|
||||
times: Int
|
||||
): AtMostCheckerOption<T, S> = AtMostCheckerOptionImpl(times, this)
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the value which we
|
||||
* are looking for occurs `not at all or at most` number of [times] within the search input.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected value is
|
||||
* found in the input of the search.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.Builder<T, S>.notOrAtMost(
|
||||
times: Int
|
||||
): NotOrAtMostCheckerOption<T, S> = NotOrAtMostCheckerOptionImpl(times, this)
|
||||
@@ -1,454 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceContainsCreatorsKt")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.builders.creating.basic.contains.addAssertion
|
||||
import ch.tutteli.atrium.domain.builders.utils.toVarArg
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains.Builder
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains.CheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.IgnoringCaseSearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.NoOpSearchBehaviour
|
||||
import ch.tutteli.atrium.logic.creating.typeutils.CharSequenceOrNumberOrChar
|
||||
import ch.tutteli.atrium.logic.creating.typeutils.IterableLike
|
||||
import ch.tutteli.kbox.glue
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected] object shall be searched,
|
||||
* using a non disjoint search.
|
||||
*
|
||||
* Delegates to [values].
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expected] is not a [CharSequence], [Number] or [Char].
|
||||
*/
|
||||
fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.value(expected: CharSequenceOrNumberOrChar): Expect<T> =
|
||||
values(expected)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected] value as well as
|
||||
* the [otherExpected] values shall be searched, using a non disjoint search.
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"a"` and [expected]
|
||||
* is defined as `"a"` and one [otherExpected] is defined as `"a"` as well, then both match, even though they match the
|
||||
* same sequence in the input of the search. Use an option such as [atLeast], [atMost] and [exactly] to control
|
||||
* the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains.exactly(2).value("a")`
|
||||
* instead of:
|
||||
* `contains.atLeast(1).values("a", "a")`
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the input of the search.
|
||||
* @param otherExpected Additional values which are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expected] or one of the [otherExpected] is not a
|
||||
* [CharSequence], [Number] or [Char].
|
||||
*/
|
||||
fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.values(
|
||||
expected: CharSequenceOrNumberOrChar,
|
||||
vararg otherExpected: CharSequenceOrNumberOrChar
|
||||
): Expect<T> = addAssertion(ExpectImpl.charSequence.contains.values(this, expected glue otherExpected))
|
||||
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected] value shall be searched
|
||||
* (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `values(expected)`.
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expected] is not a [CharSequence], [Number] or [Char].
|
||||
*/
|
||||
@JvmName("valueIgnoringCase")
|
||||
fun <T : CharSequence> CheckerOption<T, IgnoringCaseSearchBehaviour>.value(
|
||||
expected: CharSequenceOrNumberOrChar
|
||||
): Expect<T> = values(expected)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected] value as well as
|
||||
* the [otherExpected] values shall be searched (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"a"` and [expected]
|
||||
* is defined as `"a"` and one [otherExpected] is defined as `"a"` as well, then both match, even though they match the
|
||||
* same sequence in the input of the search. Use an option such as [atLeast], [atMost] and [exactly] to control
|
||||
* the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains.ignoringCase.exactly(2).value("a")`
|
||||
* instead of:
|
||||
* `contains.ignoringCase.atLeast(1).values("a", "a")`
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the input of the search.
|
||||
* @param otherExpected Additional values which are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expected] or one of the [otherExpected] is not a
|
||||
* [CharSequence], [Number] or [Char].
|
||||
*/
|
||||
@JvmName("valuesIgnoringCase")
|
||||
fun <T : CharSequence> CheckerOption<T, IgnoringCaseSearchBehaviour>.values(
|
||||
expected: CharSequenceOrNumberOrChar,
|
||||
vararg otherExpected: CharSequenceOrNumberOrChar
|
||||
): Expect<T> = addAssertion(ExpectImpl.charSequence.contains.valuesIgnoringCase(this, expected glue otherExpected))
|
||||
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected] value shall be searched
|
||||
* (ignoring case), using a non disjoint search where it needs to be contained at least once.
|
||||
*
|
||||
* Delegates to `atLeast(1).value(expected)`.
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expected] is not a [CharSequence], [Number] or [Char].
|
||||
*/
|
||||
fun <T : CharSequence> Builder<T, IgnoringCaseSearchBehaviour>.value(expected: CharSequenceOrNumberOrChar): Expect<T> =
|
||||
atLeast(1).value(expected)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected] value as well as
|
||||
* the [otherExpected] values shall be searched (ignoring case), using a non disjoint search
|
||||
* where each need to be contained at least once.
|
||||
*
|
||||
* Delegates to `atLeast(1).values(expected, otherExpected)`
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"a"` and [expected]
|
||||
* is defined as `"a"` and one [otherExpected] is defined as `"a"` as well, then both match, even though they match the
|
||||
* same sequence in the input of the search.
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the input of the search.
|
||||
* @param otherExpected Additional values which are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expected] or one of the [otherExpected] is not a
|
||||
* [CharSequence], [Number] or [Char].
|
||||
*/
|
||||
fun <T : CharSequence> Builder<T, IgnoringCaseSearchBehaviour>.values(
|
||||
expected: CharSequenceOrNumberOrChar,
|
||||
vararg otherExpected: CharSequenceOrNumberOrChar
|
||||
): Expect<T> = atLeast(1).values(expected, *otherExpected)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given regular expression [pattern]
|
||||
* as well as the [otherPatterns] are expected to have a match, using a non disjoint search.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"ab"` and [pattern]
|
||||
* is defined as `"a(b)?"` and one of the [otherPatterns] is defined as `"a(b)?"` as well, then both match, even though
|
||||
* they match the same sequence in the input of the search. Use an option such as [atLeast], [atMost] and [exactly] to
|
||||
* control the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains.exactly(2).regex("a(b)?")`
|
||||
* instead of:
|
||||
* `contains.atLeast(1).regex("a(b)?", "a(b)?")`
|
||||
*
|
||||
* @param pattern The pattern which is expected to have a match against the input of the search.
|
||||
* @param otherPatterns Additional patterns which are expected to have a match against the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.regex(
|
||||
pattern: String,
|
||||
vararg otherPatterns: String
|
||||
): Expect<T> = addAssertion(ExpectImpl.charSequence.contains.regex(this, pattern glue otherPatterns))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given [Regex] [pattern]
|
||||
* as well as the [otherPatterns] are expected to have a match, using a non disjoint search.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"ab"` and [pattern]
|
||||
* is defined as `"a(b)?"` and one of the [otherPatterns] is defined as `"a(b)?"` as well, then both match, even though
|
||||
* they match the same sequence in the input of the search. Use an option such as [atLeast], [atMost] and [exactly] to
|
||||
* control the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains.exactly(2).regex(Regex("a(b)?"))`
|
||||
* instead of:
|
||||
* `contains.atLeast(1).regex(Regex("a(b)?"), Regex("a(b)?"))`
|
||||
*
|
||||
* @param pattern The pattern which is expected to have a match against the input of the search.
|
||||
* @param otherPatterns Additional patterns which are expected to have a match against the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*
|
||||
* @since 0.9.0
|
||||
*/
|
||||
//TODO rename to `matchFor` with 1.0.0
|
||||
fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.regex(
|
||||
pattern: Regex,
|
||||
vararg otherPatterns: Regex
|
||||
): Expect<T> = addAssertion(ExpectImpl.charSequence.contains.regex(this, pattern glue otherPatterns))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given regular expression [pattern]
|
||||
* as well as the [otherPatterns] are expected to have a match (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"ab"` and [pattern]
|
||||
* is defined as `"a(b)?"` and one of the [otherPatterns] is defined as `"a(b)?"` as well, then both match, even though
|
||||
* they match the same sequence in the input of the search. Use an option such as [atLeast], [atMost] and [exactly] to
|
||||
* control the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains.ignoringCase.exactly(2).regex("a(b)?")`
|
||||
* instead of:
|
||||
* `contains.ignoringCase.atLeast(1).regex("a(b)?", "a(b)?")`
|
||||
*
|
||||
* @param pattern The pattern which is expected to have a match against the input of the search.
|
||||
* @param otherPatterns Additional patterns which are expected to have a match against the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
@JvmName("regexIgnoringCase")
|
||||
fun <T : CharSequence> CheckerOption<T, IgnoringCaseSearchBehaviour>.regex(
|
||||
pattern: String,
|
||||
vararg otherPatterns: String
|
||||
): Expect<T> = addAssertion(ExpectImpl.charSequence.contains.regexIgnoringCase(this, pattern glue otherPatterns))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given regular expression [pattern]
|
||||
* as well as the [otherPatterns] are expected to to have at least one match (ignoring case),
|
||||
* using a non disjoint search.
|
||||
*
|
||||
* Delegates to `atLeast(1).regex(pattern, otherPatterns)`
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"ab"` and [pattern]
|
||||
* is defined as `"a(b)?"` and one of the [otherPatterns] is defined as `"a(b)?"` as well, then both match, even though
|
||||
* they match the same sequence in the input of the search. Use an option such as [atLeast], [atMost] and [exactly]
|
||||
* to control the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains.ignoringCase.exactly(2).regex("a(b)?")`
|
||||
* instead of:
|
||||
* `contains.ignoringCase.atLeast(1).regex("a(b)?", "a(b)?")`
|
||||
*
|
||||
* @param pattern The pattern which is expected to have a match against the input of the search.
|
||||
* @param otherPatterns Additional patterns which are expected to have a match against the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <T : CharSequence> Builder<T, IgnoringCaseSearchBehaviour>.regex(
|
||||
pattern: String,
|
||||
vararg otherPatterns: String
|
||||
): Expect<T> = atLeast(1).regex(pattern, *otherPatterns)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterable]
|
||||
* shall be searched, using a non disjoint search.
|
||||
*
|
||||
* Delegates to `values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray())`
|
||||
* (see [values] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expectedIterable The [Iterable] whose elements are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterable] is not a [CharSequence], [Number] or [Char] or the given
|
||||
* [expectedIterable] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.9.0
|
||||
* TODO remove with 1.0.0
|
||||
*/
|
||||
fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.elementsOf(
|
||||
expectedIterable: Iterable<CharSequenceOrNumberOrChar>
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<CharSequenceOrNumberOrChar>(expectedIterable)
|
||||
return values(first, *rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterable]
|
||||
* shall be searched (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray())`
|
||||
* (see [values] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expectedIterable The [Iterable] whose elements are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterable] is not a [CharSequence], [Number] or [Char] or the given
|
||||
* [expectedIterable] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.9.0
|
||||
* TODO remove with 1.0.0
|
||||
*/
|
||||
@JvmName("elementsOfIgnoringCase")
|
||||
fun <T : CharSequence> CheckerOption<T, IgnoringCaseSearchBehaviour>.elementsOf(
|
||||
expectedIterable: Iterable<CharSequenceOrNumberOrChar>
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<CharSequenceOrNumberOrChar>(expectedIterable)
|
||||
return values(first, *rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterable]
|
||||
* shall be searched (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray())`
|
||||
* (see [values] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expectedIterable The [Iterable] whose elements are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterable] is not a [CharSequence], [Number] or [Char] or the given
|
||||
* [expectedIterable] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.11.0
|
||||
* TODO remove with 1.0.0
|
||||
*/
|
||||
@JvmName("elementsOfIgnoringCase")
|
||||
fun <T : CharSequence> Builder<T, IgnoringCaseSearchBehaviour>.elementsOf(
|
||||
expectedIterable: Iterable<CharSequenceOrNumberOrChar>
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<CharSequenceOrNumberOrChar>(expectedIterable)
|
||||
return values(first, *rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterableLike]
|
||||
* shall be searched, using a non disjoint search.
|
||||
*
|
||||
* Delegates to `values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray())`
|
||||
* (see [values] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [Iterable], [Sequence] or one of the [Array] types
|
||||
* are passed. This function expects [IterableLike] (which is a typealias for [Any]) to avoid cluttering the API.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expectedIterableLike The [IterableLike] whose elements are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types or the given
|
||||
* [expectedIterableLike] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.13.0
|
||||
*/
|
||||
fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.elementsOf(
|
||||
expectedIterableLike: IterableLike
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<CharSequenceOrNumberOrChar>(expectedIterableLike)
|
||||
return values(first, *rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterableLike]
|
||||
* shall be searched (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray())`
|
||||
* (see [values] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [Iterable], [Sequence] or one of the [Array] types
|
||||
* are passed. This function expects [IterableLike] (which is a typealias for [Any]) to avoid cluttering the API.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expectedIterableLike The [IterableLike] whose elements are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types or the given
|
||||
* [expectedIterableLike] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.13.0
|
||||
*/
|
||||
@JvmName("elementsOfIgnoringCase")
|
||||
fun <T : CharSequence> CheckerOption<T, IgnoringCaseSearchBehaviour>.elementsOf(
|
||||
expectedIterableLike: IterableLike
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<CharSequenceOrNumberOrChar>(expectedIterableLike)
|
||||
return values(first, *rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterableLike]
|
||||
* shall be searched (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray())`
|
||||
* (see [values] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [Iterable], [Sequence] or one of the [Array] types
|
||||
* are passed. This function expects [IterableLike] (which is a typealias for [Any]) to avoid cluttering the API.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expectedIterableLike The [IterableLike] whose elements are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types or the given
|
||||
* [expectedIterableLike] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.13.0
|
||||
*/
|
||||
@JvmName("elementsOfIgnoringCase")
|
||||
fun <T : CharSequence> Builder<T, IgnoringCaseSearchBehaviour>.elementsOf(
|
||||
expectedIterableLike: IterableLike
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<CharSequenceOrNumberOrChar>(expectedIterableLike)
|
||||
return values(first, *rest)
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceContainsSearchBehavioursKt")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.NotCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl.NotCheckerOptionImpl
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.IgnoringCaseSearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.NoOpSearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.NotSearchBehaviour
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Defines that the v behaviour `ignore case` shall be applied to this sophisticated `contains` assertion.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
val <T : CharSequence> CharSequenceContains.Builder<T, NoOpSearchBehaviour>.ignoringCase: CharSequenceContains.Builder<T, IgnoringCaseSearchBehaviour>
|
||||
get() : CharSequenceContains.Builder<T, IgnoringCaseSearchBehaviour> =
|
||||
ExpectImpl.charSequence.contains.searchBehaviours.ignoringCase(this)
|
||||
|
||||
/**
|
||||
* Defines that the search behaviour `ignore case` shall be applied to this sophisticated `contains not` assertion.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
val <T : CharSequence> NotCheckerOption<T, NotSearchBehaviour>.ignoringCase: NotCheckerOption<T, IgnoringCaseSearchBehaviour>
|
||||
get() : NotCheckerOption<T, IgnoringCaseSearchBehaviour> =
|
||||
NotCheckerOptionImpl(containsBuilder.ignoringCase)
|
||||
@@ -1,21 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.WithTimesCheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains at least`-check within a sophisticated
|
||||
* `contains` assertion building process for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use AtLeastCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.charsequence.contains.steps.AtLeastCheckerStep")
|
||||
)
|
||||
interface AtLeastCheckerOption<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>
|
||||
: WithTimesCheckerOption<T, S>
|
||||
@@ -1,20 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains at least once but at most`-check within
|
||||
* a sophisticated `contains` assertion building process for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use AtMostCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.charsequence.contains.steps.AtMostCheckerStep")
|
||||
)
|
||||
interface AtMostCheckerOption<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>
|
||||
: CharSequenceContains.CheckerOption<T, S>
|
||||
@@ -1,20 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains at least but at most`-check within
|
||||
* a sophisticated `contains` assertion building process for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use ButAtMostCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.charsequence.contains.steps.ButAtMostCheckerStep")
|
||||
)
|
||||
interface ButAtMostCheckerOption<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>
|
||||
: CharSequenceContains.CheckerOption<T, S>
|
||||
@@ -1,20 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains exactly`-check within
|
||||
* a sophisticated `contains` assertion building process for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use ExactlyCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.charsequence.contains.steps.ExactlyCheckerStep")
|
||||
)
|
||||
interface ExactlyCheckerOption<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>
|
||||
: CharSequenceContains.CheckerOption<T, S>
|
||||
@@ -1,20 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains not at all`-check within
|
||||
* a sophisticated `contains` assertion building process for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use NotCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.charsequence.contains.steps.NotCheckerStep")
|
||||
)
|
||||
interface NotCheckerOption<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>
|
||||
: CharSequenceContains.CheckerOption<T, S>
|
||||
@@ -1,20 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains not or at most`-check within
|
||||
* a sophisticated `contains` assertion building process for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"use NotOrAtMostCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.charsequence.contains.steps.NotOrAtMostCheckerStep")
|
||||
)
|
||||
interface NotOrAtMostCheckerOption<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>
|
||||
: CharSequenceContains.CheckerOption<T, S>
|
||||
@@ -1,32 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.AtLeastCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.AtLeastCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains at least`-check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains at least` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [CharSequence].
|
||||
* @param times The number which the check will compare against the actual number of times an expected object is
|
||||
* found in the input of the search.
|
||||
* @param containsBuilder The previously used [CharSequenceContains.Builder].
|
||||
*/
|
||||
internal class AtLeastCheckerOptionImpl<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: CharSequenceContains.Builder<T, S>
|
||||
) : AtLeastCheckerOptionBase<T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "atLeast($it)" }
|
||||
), AtLeastCheckerOption<T, S>
|
||||
@@ -1,34 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.AtMostCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.AtMostCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains at least once but at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains at least once but at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [CharSequence].
|
||||
* @param times The number which the check will compare against the actual number of times an expected object is
|
||||
* found in the input of the search.
|
||||
* @param containsBuilder The previously used [CharSequenceContains.Builder].
|
||||
*/
|
||||
internal class AtMostCheckerOptionImpl<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: CharSequenceContains.Builder<T, S>
|
||||
) : AtMostCheckerOptionBase<T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "atMost($it)" },
|
||||
{ "atLeast($it)" },
|
||||
{ "exactly($it)" }
|
||||
), AtMostCheckerOption<T, S>
|
||||
@@ -1,39 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.AtLeastCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.ButAtMostCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.ButAtMostCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the builder of the second step of a `contains at least but at most` check within the
|
||||
* fluent API of a sophisticated `contains` assertion for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied to the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of the second step of a `contains at least but at most` check within the
|
||||
* fluent API of a sophisticated `contains` assertion for [CharSequence].
|
||||
* @param times The number which the check will compare against the actual number of times an expected object is
|
||||
* found in the input of the search.
|
||||
* @param containsBuilder The previously used [CharSequenceContains.Builder].
|
||||
*/
|
||||
internal class ButAtMostCheckerOptionImpl<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>(
|
||||
times: Int,
|
||||
atLeastBuilder: AtLeastCheckerOption<T, S>,
|
||||
containsBuilder: CharSequenceContains.Builder<T, S>
|
||||
) : ButAtMostCheckerOptionBase<T, S>(
|
||||
times,
|
||||
atLeastBuilder,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ l, u -> "atLeast($l).butAtMost($u)" },
|
||||
{ "atMost($it)" },
|
||||
{ "atLeast($it)" },
|
||||
{ "butAtMost($it)" },
|
||||
{ "exactly($it)" }
|
||||
), ButAtMostCheckerOption<T, S>
|
||||
@@ -1,32 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.ExactlyCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.ExactlyCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains exactly` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains exactly` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [CharSequence].
|
||||
* @param times The number which the check will compare against the actual number of times an expected object is
|
||||
* found in the input of the search.
|
||||
* @param containsBuilder The previously used [CharSequenceContains.Builder].
|
||||
*/
|
||||
internal class ExactlyCheckerOptionImpl<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: CharSequenceContains.Builder<T, S>
|
||||
) : ExactlyCheckerOptionBase<T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "exactly($it)" }
|
||||
), ExactlyCheckerOption<T, S>
|
||||
@@ -1,24 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.NotCheckerOption
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.NotCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains not at all` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains not at all` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [CharSequence].
|
||||
* @param containsBuilder The previously used [CharSequenceContains.Builder].
|
||||
*/
|
||||
internal class NotCheckerOptionImpl<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>(
|
||||
containsBuilder: CharSequenceContains.Builder<T, S>
|
||||
) : NotCheckerOptionBase<T, S>(containsBuilder),
|
||||
NotCheckerOption<T, S>
|
||||
@@ -1,32 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.NotOrAtMostCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.NotOrAtMostCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains not or at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains not or at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [CharSequence].
|
||||
* @param times The number which the check will compare against the actual number of times an expected object is
|
||||
* found in the input of the search.
|
||||
* @param containsBuilder The previously used [CharSequenceContains.Builder].
|
||||
*/
|
||||
internal class NotOrAtMostCheckerOptionImpl<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: CharSequenceContains.Builder<T, S>
|
||||
) : NotOrAtMostCheckerOptionBase<T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "notOrAtMost($it)" }
|
||||
), NotOrAtMostCheckerOption<T, S>
|
||||
@@ -1,12 +0,0 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.containsNot
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import kotlin.reflect.KFunction3
|
||||
|
||||
internal object StaticName {
|
||||
private val f: KFunction3<Expect<CharSequence>, Any, Array<out Any>, Expect<CharSequence>> =
|
||||
Expect<CharSequence>::containsNot
|
||||
val nameContainsNotValuesFun = f.name
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.WithTimesCheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains at least`-check within a sophisticated
|
||||
* `contains` assertion building process for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use AtLeastCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.iterable.contains.steps.AtLeastCheckerStep")
|
||||
)
|
||||
interface AtLeastCheckerOption<out E, out T : Iterable<E>, out S : IterableContains.SearchBehaviour>
|
||||
: WithTimesCheckerOption<E, T, S>
|
||||
@@ -1,21 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.WithTimesCheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains at least once but at most`-check within
|
||||
* a sophisticated `contains` assertion building process for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use AtMostCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.iterable.contains.steps.AtMostCheckerStep")
|
||||
)
|
||||
interface AtMostCheckerOption<out E, out T : Iterable<E>, out S : IterableContains.SearchBehaviour>
|
||||
: WithTimesCheckerOption<E, T, S>
|
||||
@@ -1,21 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.WithTimesCheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains at least but at most`-check within a
|
||||
* sophisticated `contains` assertion building process for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use ButAtMostCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.iterable.contains.steps.ButAtMostCheckerStep")
|
||||
)
|
||||
interface ButAtMostCheckerOption<out E, out T : Iterable<E>, out S : IterableContains.SearchBehaviour>
|
||||
: WithTimesCheckerOption<E, T, S>
|
||||
@@ -1,21 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.WithTimesCheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains exactly`-check within
|
||||
* a sophisticated `contains` assertion building process for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use ExactlyCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.iterable.contains.steps.ExactlyCheckerStep")
|
||||
)
|
||||
interface ExactlyCheckerOption<out E, out T : Iterable<E>, out S : IterableContains.SearchBehaviour>
|
||||
: WithTimesCheckerOption<E, T, S>
|
||||
@@ -1,20 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains not at all`-check within
|
||||
* a sophisticated `contains` assertion building process for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use NotCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.iterable.contains.steps.NotCheckerStep")
|
||||
)
|
||||
interface NotCheckerOption<out E, out T : Iterable<E>, out S : IterableContains.SearchBehaviour>
|
||||
: IterableContains.CheckerOption<E, T, S>
|
||||
@@ -1,21 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.WithTimesCheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains not or at most`-check within
|
||||
* a sophisticated `contains` assertion building process for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use NotOrAtMostCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.iterable.contains.steps.NotOrAtMostCheckerStep")
|
||||
)
|
||||
interface NotOrAtMostCheckerOption<out E, out T : Iterable<E>, out S : IterableContains.SearchBehaviour>
|
||||
: WithTimesCheckerOption<E, T, S>
|
||||
@@ -1,32 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.AtLeastCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.AtLeastCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains at least` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains at least` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [Iterable].
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
* @param containsBuilder The previously used [IterableContains.Builder].
|
||||
*/
|
||||
internal class AtLeastCheckerOptionImpl<out E, out T : Iterable<E>, out S : InAnyOrderSearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: IterableContains.Builder<E, T, S>
|
||||
) : AtLeastCheckerOptionBase<E, T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "atLeast($it)" }
|
||||
), AtLeastCheckerOption<E, T, S>
|
||||
@@ -1,34 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.AtMostCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.AtMostCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains at least once but at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains at least once but at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [Iterable].
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
* @param containsBuilder The previously used [IterableContains.Builder].
|
||||
*/
|
||||
internal class AtMostCheckerOptionImpl<out E, out T : Iterable<E>, out S : InAnyOrderSearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: IterableContains.Builder<E, T, S>
|
||||
) : AtMostCheckerOptionBase<E, T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "atMost($it)" },
|
||||
{ "atLeast($it)" },
|
||||
{ "exactly($it)" }
|
||||
), AtMostCheckerOption<E, T, S>
|
||||
@@ -1,39 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.AtLeastCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.ButAtMostCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.ButAtMostCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Represents the builder of the second step of a `contains at least but at most` check within the
|
||||
* fluent API of a sophisticated `contains` assertion for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
*
|
||||
* @constructor Represents the builder of the second step of a `contains at least but at most` check within the
|
||||
* fluent API of a sophisticated `contains` assertion for [Iterable].
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
* @param containsBuilder The previously used [IterableContains.Builder].
|
||||
*/
|
||||
internal class ButAtMostCheckerOptionImpl<out E, out T : Iterable<E>, out S : InAnyOrderSearchBehaviour>(
|
||||
times: Int,
|
||||
atLeastBuilder: AtLeastCheckerOption<E, T, S>,
|
||||
containsBuilder: IterableContains.Builder<E, T, S>
|
||||
) : ButAtMostCheckerOptionBase<E, T, S>(
|
||||
times,
|
||||
atLeastBuilder,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ l, u -> "atLeast($l).butAtMost($u)" },
|
||||
{ "atMost($it)" },
|
||||
{ "atLeast($it)" },
|
||||
{ "butAtMost($it)" },
|
||||
{ "exactly($it)" }
|
||||
), ButAtMostCheckerOption<E, T, S>
|
||||
@@ -1,32 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.ExactlyCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.ExactlyCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains exactly` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains exactly` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [Iterable].
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
* @param containsBuilder The previously used [IterableContains.Builder].
|
||||
*/
|
||||
internal class ExactlyCheckerOptionImpl<out E, out T : Iterable<E>, out S : InAnyOrderSearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: IterableContains.Builder<E, T, S>
|
||||
) : ExactlyCheckerOptionBase<E, T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "exactly($it)" }
|
||||
), ExactlyCheckerOption<E, T, S>
|
||||
@@ -1,25 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.NotCheckerOption
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.NotCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains not at all` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains not at all` check within the fluent API of a sophisticated
|
||||
* `contains not` assertion for [Iterable].
|
||||
* @param containsBuilder The previously used [IterableContains.Builder].
|
||||
*/
|
||||
internal class NotCheckerOptionImpl<out E, out T : Iterable<E>, out S : InAnyOrderSearchBehaviour>(
|
||||
containsBuilder: IterableContains.Builder<E, T, S>
|
||||
) : NotCheckerOptionBase<E, T, S>(containsBuilder),
|
||||
NotCheckerOption<E, T, S>
|
||||
@@ -1,32 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.NotOrAtMostCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.NotOrAtMostCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains not or at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains at least once but at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [Iterable].
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
* @param containsBuilder The previously used [IterableContains.Builder].
|
||||
*/
|
||||
internal class NotOrAtMostCheckerOptionImpl<out E, out T : Iterable<E>, out S : InAnyOrderSearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: IterableContains.Builder<E, T, S>
|
||||
) : NotOrAtMostCheckerOptionBase<E, T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "notOrAtMost($it)" }
|
||||
), NotOrAtMostCheckerOption<E, T, S>
|
||||
@@ -1,14 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.containsNot
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import kotlin.reflect.KFunction3
|
||||
|
||||
internal object StaticName {
|
||||
private val f: KFunction3<Expect<Iterable<Double>>, Double, Array<out Double>, Expect<Iterable<Double>>> =
|
||||
Expect<Iterable<Double>>::containsNot
|
||||
val nameContainsNotValuesFun = f.name
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("IterableAssertionsKt")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.NotCheckerOption
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl.NotCheckerOptionImpl
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.NoOpSearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.NotSearchBehaviour
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Creates an [IterableContains.Builder] based on this [Expect] which allows to define
|
||||
* more sophisticated `contains` assertions.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
@Deprecated("Only here to retain binary backward compatibility; will be removed with 1.0.0")
|
||||
fun <E, T : Iterable<E>> getContains(expect: Expect<T>): IterableContains.Builder<E, T, NoOpSearchBehaviour> =
|
||||
ExpectImpl.iterable.containsBuilder(expect)
|
||||
|
||||
/**
|
||||
* Creates an [IterableContains.Builder] based on this [Expect] which allows to define
|
||||
* more sophisticated `contains not` assertions.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
@Deprecated("Only here to retain binary backward compatibility; will be removed with 1.0.0")
|
||||
fun <E, T : Iterable<E>> getContainsNot(expect: Expect<T>): NotCheckerOption<E, T, NotSearchBehaviour> =
|
||||
NotCheckerOptionImpl(ExpectImpl.iterable.containsNotBuilder(expect))
|
||||
@@ -1,93 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.*
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders.impl.*
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the entry which we are looking
|
||||
* for occurs `at least` number of [times] within the [Iterable].
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
fun <E, T : Iterable<E>, S : InAnyOrderSearchBehaviour> IterableContains.Builder<E, T, S>.atLeast(
|
||||
times: Int
|
||||
): AtLeastCheckerOption<E, T, S> = AtLeastCheckerOptionImpl(times, this)
|
||||
|
||||
/**
|
||||
* Restricts a `contains at least` assertion by specifying that the number of occurrences of the entry which we
|
||||
* are looking for occurs `at most` number of [times] within the [Iterable].
|
||||
*
|
||||
* The resulting restriction will be a `contains at least but at most` assertion.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
*
|
||||
* @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] of this `at most` restriction equals to the number of the
|
||||
* `at least` restriction; use the [exactly] restriction instead.
|
||||
*/
|
||||
fun <E, T : Iterable<E>, S : InAnyOrderSearchBehaviour> AtLeastCheckerOption<E, T, S>.butAtMost(
|
||||
times: Int
|
||||
): ButAtMostCheckerOption<E, T, S> = ButAtMostCheckerOptionImpl(times, this, containsBuilder)
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the entry which we
|
||||
* are looking for occurs `exactly` number of [times] within the [Iterable].
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
fun <E, T : Iterable<E>, S : InAnyOrderSearchBehaviour> IterableContains.Builder<E, T, S>.exactly(
|
||||
times: Int
|
||||
): ExactlyCheckerOption<E, T, S> = ExactlyCheckerOptionImpl(times, this)
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the entry which we
|
||||
* are looking for occurs `at least` once but `at most` number of [times] within the [Iterable].
|
||||
*
|
||||
* If you want to use a higher lower bound than one, then use `atLeast(2).butAtMost(3)` instead of `atMost(3)`.
|
||||
* And in case you want to state that it is either not contained at all or at most a certain number of times,
|
||||
* then use `notOrAtMost(2)` instead.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
*
|
||||
* @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 one; use [exactly] instead.
|
||||
*/
|
||||
fun <E, T : Iterable<E>, S : InAnyOrderSearchBehaviour> IterableContains.Builder<E, T, S>.atMost(
|
||||
times: Int
|
||||
): AtMostCheckerOption<E, T, S> = AtMostCheckerOptionImpl(times, this)
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the entry which we
|
||||
* are looking for occurs `not at all or at most` number of [times] within the [Iterable].
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
fun <E, T : Iterable<E>, S : InAnyOrderSearchBehaviour> IterableContains.Builder<E, T, S>.notOrAtMost(
|
||||
times: Int
|
||||
): NotOrAtMostCheckerOption<E, T, S> = NotOrAtMostCheckerOptionImpl(times, this)
|
||||
@@ -1,138 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.builders.creating.basic.contains.addAssertion
|
||||
import ch.tutteli.atrium.domain.builders.utils.toVarArg
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains.CheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.typeutils.IterableLike
|
||||
import ch.tutteli.kbox.glue
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected]
|
||||
* value shall be searched within the [Iterable].
|
||||
*
|
||||
* Delegates to [values].
|
||||
*
|
||||
* @param expected The value which is expected to be contained within this [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E, T : Iterable<E>> CheckerOption<E, T, InAnyOrderSearchBehaviour>.value(expected: E): Expect<T> =
|
||||
values(expected)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected]
|
||||
* value as well as the [otherExpected] values (if given) shall be searched within the [Iterable].
|
||||
*
|
||||
* Notice, that it does not search for unique matches. Meaning, if the iterable is `setOf('a', 'b')` and
|
||||
* [expected] is defined as `'a'` and one [otherExpected] is defined as `'a'` as well, then both match,
|
||||
* even though they match the same entry. Use an option such as [atLeast], [atMost] and [exactly] to control the
|
||||
* number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains.inAnyOrder.exactly(2).values('a')`
|
||||
* instead of:
|
||||
* `contains.inAnyOrder.atLeast(1).values('a', 'a')`
|
||||
*
|
||||
* @param expected The object which is expected to be contained within this [Iterable].
|
||||
* @param otherExpected Additional objects which are expected to be contained within this [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E, T : Iterable<E>> CheckerOption<E, T, InAnyOrderSearchBehaviour>.values(
|
||||
expected: E,
|
||||
vararg otherExpected: E
|
||||
): Expect<T> = addAssertion(ExpectImpl.iterable.contains.valuesInAnyOrder(this, expected glue otherExpected))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where an entry shall be searched which either
|
||||
* holds all assertions [assertionCreatorOrNull] creates or needs to be `null` in case [assertionCreatorOrNull]
|
||||
* is defined as `null`.
|
||||
*
|
||||
* Delegates to [entries].
|
||||
*
|
||||
* @param assertionCreatorOrNull The identification lambda which creates the assertions which the entry we are looking
|
||||
* for has to hold; or in other words, the function which defines whether an entry is the one we are looking for
|
||||
* or not. In case it is defined as `null`, then an entry is identified if it is `null` as well.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E : Any, T : Iterable<E?>> CheckerOption<E?, T, InAnyOrderSearchBehaviour>.entry(
|
||||
assertionCreatorOrNull: (Expect<E>.() -> Unit)?
|
||||
): Expect<T> = entries(assertionCreatorOrNull)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where an entry shall be searched which either
|
||||
* holds all assertions [assertionCreatorOrNull] creates or needs to be `null` in case
|
||||
* [assertionCreatorOrNull] is defined as `null` -- likewise an entry (can be the same) is searched for each
|
||||
* of the [otherAssertionCreatorsOrNulls].
|
||||
*
|
||||
* @param assertionCreatorOrNull The identification lambda which creates the assertions which the entry we are looking
|
||||
* for has to hold; or in other words, the function which defines whether an entry is the one we are looking for
|
||||
* or not. In case it is defined as `null`, then an entry is identified if it is `null` as well.
|
||||
* @param otherAssertionCreatorsOrNulls Additional identification lambdas which each identify (separately) an entry
|
||||
* which we are looking for (see [assertionCreatorOrNull] for more information).
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E : Any, T : Iterable<E?>> CheckerOption<E?, T, InAnyOrderSearchBehaviour>.entries(
|
||||
assertionCreatorOrNull: (Expect<E>.() -> Unit)?,
|
||||
vararg otherAssertionCreatorsOrNulls: (Expect<E>.() -> Unit)?
|
||||
): Expect<T> = addAssertion(
|
||||
ExpectImpl.iterable.contains.entriesInAnyOrder(
|
||||
this,
|
||||
assertionCreatorOrNull glue otherAssertionCreatorsOrNulls
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterable]
|
||||
* shall be searched within the [Iterable].
|
||||
*
|
||||
* Delegates to [values] which also means that it does not search for unique matches
|
||||
* (see [values] for more information).
|
||||
*
|
||||
* @param expectedIterable The [Iterable] whose elements are expected to be contained within this [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case the given [expectedIterable] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.9.0
|
||||
* TODO remove with 1.0.0
|
||||
*/
|
||||
inline fun <reified E, T : Iterable<E>> CheckerOption<E, T, InAnyOrderSearchBehaviour>.elementsOf(
|
||||
expectedIterable: Iterable<E>
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<E>(expectedIterable)
|
||||
return values(first, *rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterableLike]
|
||||
* shall be searched within the [Iterable].
|
||||
*
|
||||
* Delegates to [values] which also means that it does not search for unique matches
|
||||
* (see [values] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [Iterable], [Sequence] or one of the [Array] types
|
||||
* are passed. This function expects [IterableLike] (which is a typealias for [Any]) to avoid cluttering the API.
|
||||
*
|
||||
* @param expectedIterableLike The [IterableLike] whose elements are expected to be contained within this [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types
|
||||
* or the given [expectedIterableLike] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.13.0
|
||||
*/
|
||||
inline fun <reified E, T : Iterable<E>> CheckerOption<E, T, InAnyOrderSearchBehaviour>.elementsOf(
|
||||
expectedIterableLike: IterableLike
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<E>(expectedIterableLike)
|
||||
return values(first, *rest)
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.builders.creating.basic.contains.addAssertion
|
||||
import ch.tutteli.atrium.domain.builders.utils.toVarArg
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains.Builder
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderOnlySearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.typeutils.IterableLike
|
||||
import ch.tutteli.kbox.glue
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [Iterable] needs to contain only the
|
||||
* [expected] value.
|
||||
*
|
||||
* Delegates to [values].
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E, T : Iterable<E>> Builder<E, T, InAnyOrderOnlySearchBehaviour>.value(expected: E): Expect<T> =
|
||||
values(expected)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected]
|
||||
* value as well as the [otherExpected] values (if given) need to be
|
||||
* contained in [Iterable] where it does not matter in which order but only as
|
||||
* many entries should be returned by the [Iterable] as values defined.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the [Iterable].
|
||||
* @param otherExpected Additional values which are expected to be contained within [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E, T : Iterable<E>> Builder<E, T, InAnyOrderOnlySearchBehaviour>.values(
|
||||
expected: E,
|
||||
vararg otherExpected: E
|
||||
): Expect<T> = addAssertion(ExpectImpl.iterable.contains.valuesInAnyOrderOnly(this, expected glue otherExpected))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [Iterable] needs to contain only one
|
||||
* entry which holds all assertions created by the given [assertionCreatorOrNull] or is `null` in case
|
||||
* [assertionCreatorOrNull] is defined as `null`.
|
||||
*
|
||||
* Delegates to [entries].
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param assertionCreatorOrNull The identification lambda which creates the assertions which the entry we are looking
|
||||
* for has to hold; or in other words, the function which defines whether an entry is the one we are looking for
|
||||
* or not. In case it is defined as `null`, then an entry is identified if it is `null` as well.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E : Any, T : Iterable<E?>> Builder<E?, T, InAnyOrderOnlySearchBehaviour>.entry(
|
||||
assertionCreatorOrNull: (Expect<E>.() -> Unit)?
|
||||
): Expect<T> = entries(assertionCreatorOrNull)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where an entry needs to be contained in the
|
||||
* [Iterable] which holds all assertions [assertionCreatorOrNull] creates or needs to be `null` in case
|
||||
* [assertionCreatorOrNull] is defined as `null` -- likewise an entry for each
|
||||
* [otherAssertionCreatorsOrNulls] needs to be contained in the [Iterable] where it does not matter in which order the
|
||||
* entries appear but only as many entries should be returned by the [Iterable] as assertion creators are defined.
|
||||
*
|
||||
* Notice, that a first-wins strategy applies which means your assertion creator lambdas -- which kind of serve as
|
||||
* identification lambdas -- should be ordered in such a way that the most specific identification lambda appears
|
||||
* first, not that a less specific lambda wins. For instance, given a `setOf(1, 2)` you should not search for
|
||||
* `entries({ isGreaterThan(0) }, { toBe(1) })` but for
|
||||
* `entries({ toBe(1) }, { isGreaterThan(0) })` otherwise
|
||||
* `isGreaterThan(0)` matches `1` before `toBe(1)` would match it. As a consequence `toBe(1)` could only match the
|
||||
* entry which is left -- in this case `2` -- and of course this would fail.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param assertionCreatorOrNull The identification lambda which creates the assertions which the entry we are looking
|
||||
* for has to hold; or in other words, the function which defines whether an entry is the one we are looking for
|
||||
* or not. In case it is defined as `null`, then an entry is identified if it is `null` as well.
|
||||
* @param otherAssertionCreatorsOrNulls Additional identification lambdas which each identify (separately) an entry
|
||||
* which we are looking for (see [assertionCreatorOrNull] for more information).
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E : Any, T : Iterable<E?>> Builder<E?, T, InAnyOrderOnlySearchBehaviour>.entries(
|
||||
assertionCreatorOrNull: (Expect<E>.() -> Unit)?,
|
||||
vararg otherAssertionCreatorsOrNulls: (Expect<E>.() -> Unit)?
|
||||
): Expect<T> = addAssertion(
|
||||
ExpectImpl.iterable.contains.entriesInAnyOrderOnly(
|
||||
this,
|
||||
assertionCreatorOrNull glue otherAssertionCreatorsOrNulls
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements in
|
||||
* [expectedIterable] need to be contained in [Iterable] where it does not matter in which order but only as
|
||||
* many entries should be returned by the [Iterable] as values defined.
|
||||
*
|
||||
* Delegates to [values].
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expectedIterable The [Iterable] whose elements are expected to be contained within this [Iterable]
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case the given [expectedIterable] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.9.0
|
||||
* TODO remove with 1.0.0
|
||||
*/
|
||||
inline fun <reified E, T : Iterable<E>> Builder<E, T, InAnyOrderOnlySearchBehaviour>.elementsOf(
|
||||
expectedIterable: Iterable<E>
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<E>(expectedIterable)
|
||||
return values(first, *rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements in
|
||||
* [expectedIterableLike] need to be contained in [Iterable] where it does not matter in which order but only as
|
||||
* many entries should be returned by the [Iterable] as values defined.
|
||||
*
|
||||
* Delegates to [values].
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [Iterable], [Sequence] or one of the [Array] types
|
||||
* are passed. This function expects [IterableLike] (which is a typealias for [Any]) to avoid cluttering the API.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expectedIterableLike The [IterableLike] whose elements are expected to be contained within this [Iterable]
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types
|
||||
* or the given [expectedIterableLike] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.13.0
|
||||
*/
|
||||
inline fun <reified E, T : Iterable<E>> Builder<E, T, InAnyOrderOnlySearchBehaviour>.elementsOf(
|
||||
expectedIterableLike: IterableLike
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<E>(expectedIterableLike)
|
||||
return values(first, *rest)
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.builders.creating.basic.contains.addAssertion
|
||||
import ch.tutteli.atrium.domain.builders.utils.toVarArg
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains.Builder
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InOrderOnlySearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.typeutils.IterableLike
|
||||
import ch.tutteli.kbox.glue
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [Iterable] needs to contain only the
|
||||
* [expected] value.
|
||||
*
|
||||
* Delegates to [values].
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E, T : Iterable<E>> Builder<E, T, InOrderOnlySearchBehaviour>.value(expected: E): Expect<T> =
|
||||
values(expected)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [Iterable] needs to contain only the
|
||||
* [expected] value as well as the [otherExpected] values
|
||||
* (if given) in the specified order.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the [Iterable].
|
||||
* @param otherExpected Additional values which are expected to be contained within [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E, T : Iterable<E>> Builder<E, T, InOrderOnlySearchBehaviour>.values(
|
||||
expected: E,
|
||||
vararg otherExpected: E
|
||||
): Expect<T> = addAssertion(ExpectImpl.iterable.contains.valuesInOrderOnly(this, expected glue otherExpected))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [Iterable] needs to contain only a
|
||||
* single entry which holds all assertions created by the given [assertionCreatorOrNull] or needs to be `null`
|
||||
* in case [assertionCreatorOrNull] is defined as `null`.
|
||||
*
|
||||
* Delegates to `entries(assertionCreatorOrNull)`.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param assertionCreatorOrNull The identification lambda which creates the assertions which the entry we are looking
|
||||
* for has to hold; or in other words, the function which defines whether an entry is the one we are looking for
|
||||
* or not. In case it is defined as `null`, then an entry is identified if it is `null` as well.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E : Any, T : Iterable<E?>> Builder<E?, T, InOrderOnlySearchBehaviour>.entry(
|
||||
assertionCreatorOrNull: (Expect<E>.() -> Unit)?
|
||||
): Expect<T> = entries(assertionCreatorOrNull)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [Iterable] needs to contain only an
|
||||
* entry which holds all assertions [assertionCreatorOrNull] creates or is `null` in case [assertionCreatorOrNull]
|
||||
* is defined as `null` and likewise a further entry for each
|
||||
* [otherAssertionCreatorsOrNulls] (if given) whereas the entries have to appear in the specified order.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param assertionCreatorOrNull The identification lambda which creates the assertions which the entry we are looking
|
||||
* for has to hold; or in other words, the function which defines whether an entry is the one we are looking for
|
||||
* or not. In case it is defined as `null`, then an entry is identified if it is `null` as well.
|
||||
* @param otherAssertionCreatorsOrNulls Additional identification lambdas which each identify (separately) an entry
|
||||
* which we are looking for (see [assertionCreatorOrNull] for more information).
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E : Any, T : Iterable<E?>> Builder<E?, T, InOrderOnlySearchBehaviour>.entries(
|
||||
assertionCreatorOrNull: (Expect<E>.() -> Unit)?,
|
||||
vararg otherAssertionCreatorsOrNulls: (Expect<E>.() -> Unit)?
|
||||
): Expect<T> = addAssertion(
|
||||
ExpectImpl.iterable.contains.entriesInOrderOnly(
|
||||
this,
|
||||
assertionCreatorOrNull glue otherAssertionCreatorsOrNulls
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterable]
|
||||
* shall be searched within the [Iterable]
|
||||
* (if given) in the specified order.
|
||||
*
|
||||
* Delegates to [values].
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expectedIterable The [Iterable] whose elements are expected to be contained within this [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case the given [expectedIterable] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.9.0
|
||||
* TODO remove with 1.0.0
|
||||
*/
|
||||
inline fun <reified E, T : Iterable<E>> Builder<E, T, InOrderOnlySearchBehaviour>.elementsOf(
|
||||
expectedIterable: Iterable<E>
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<E>(expectedIterable)
|
||||
return values(first, *rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterableLike]
|
||||
* shall be searched within the [Iterable]
|
||||
* (if given) in the specified order.
|
||||
*
|
||||
* Delegates to [values].
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [Iterable], [Sequence] or one of the [Array] types
|
||||
* are passed. This function expects [IterableLike] (which is a typealias for [Any]) to avoid cluttering the API.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expectedIterableLike The [IterableLike] whose elements are expected to be contained within this [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types
|
||||
* or the given [expectedIterableLike] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.13.0
|
||||
*/
|
||||
inline fun <reified E, T : Iterable<E>> Builder<E, T, InOrderOnlySearchBehaviour>.elementsOf(
|
||||
expectedIterableLike: IterableLike
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<E>(expectedIterableLike)
|
||||
return values(first, *rest)
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.builders.creating.basic.contains.addAssertion
|
||||
import ch.tutteli.atrium.domain.builders.utils.Group
|
||||
import ch.tutteli.atrium.domain.builders.utils.groupsToList
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains.Builder
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InOrderOnlyGroupedWithinSearchBehaviour
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the expected [firstGroup] as well as
|
||||
* the [secondGroup] and optionally [otherExpectedGroups] of values need to be contained in [Iterable]
|
||||
* as only elements and in the specified order whereas the values within the groups can occur in any order.
|
||||
*
|
||||
* @param firstGroup A group of values which have to appear at first within the [Iterable].
|
||||
* @param secondGroup A group of values which have to appear after the values of the [firstGroup] within the [Iterable].
|
||||
* @param otherExpectedGroups Additional groups of values which are expected to appear after the [secondGroup] within
|
||||
* [Iterable] whereas the groups have to appear in the given order.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
fun <E, T : Iterable<E>> Builder<E, T, InOrderOnlyGroupedWithinSearchBehaviour>.inAnyOrder(
|
||||
firstGroup: Group<E>,
|
||||
secondGroup: Group<E>,
|
||||
vararg otherExpectedGroups: Group<E>
|
||||
): Expect<T> = addAssertion(
|
||||
ExpectImpl.iterable.contains.valuesInOrderOnlyGrouped(
|
||||
this,
|
||||
groupsToList(firstGroup, secondGroup, otherExpectedGroups)
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the expected [firstGroup] as well as
|
||||
* the [secondGroup] and optionally [otherExpectedGroups] of identification lambdas, identifying an entry,
|
||||
* need to be contained in [Iterable] as only elements and in the specified order whereas
|
||||
* the identification lambdas within the groups can occur in any order.
|
||||
*
|
||||
* An identification lambda can also be defined as `null` in which case it matches an entry which is `null` as well.
|
||||
* Have a look at [entries] for more information about identification lambdas.
|
||||
*
|
||||
* @param firstGroup A group of identification lambdas which have to appear at first within the [Iterable].
|
||||
* @param secondGroup A group of identification lambdas which have to appear after the values of the [firstGroup]
|
||||
* within the [Iterable].
|
||||
* @param otherExpectedGroups Additional groups of values which are expected to appear after the [secondGroup] within
|
||||
* [Iterable] whereas the groups have to appear in the given order.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
@JvmName("inAnyOrderEntries")
|
||||
fun <E : Any, T : Iterable<E?>> Builder<E?, T, InOrderOnlyGroupedWithinSearchBehaviour>.inAnyOrder(
|
||||
firstGroup: Group<(Expect<E>.() -> Unit)?>,
|
||||
secondGroup: Group<(Expect<E>.() -> Unit)?>,
|
||||
vararg otherExpectedGroups: Group<(Expect<E>.() -> Unit)?>
|
||||
): Expect<T> = addAssertion(
|
||||
ExpectImpl.iterable.contains.entriesInOrderOnlyGrouped(
|
||||
this,
|
||||
groupsToList(firstGroup, secondGroup, otherExpectedGroups)
|
||||
)
|
||||
)
|
||||
@@ -1,65 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains.Builder
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.*
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Defines that the search behaviour "find entries `in any order` in the [Iterable]" shall be applied to this
|
||||
* sophisticated `contains` in [Iterable] assertion.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
val <E, T : Iterable<E>> Builder<E, T, NoOpSearchBehaviour>.inAnyOrder: Builder<E, T, InAnyOrderSearchBehaviour>
|
||||
get() = ExpectImpl.iterable.contains.searchBehaviours.inAnyOrder(this)
|
||||
|
||||
/**
|
||||
* Defines that the constraint "`only` the specified entries exist in the [Iterable]" shall be applied to this
|
||||
* sophisticated `contains` [Iterable] assertion.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
val <E, T : Iterable<E>> Builder<E, T, InAnyOrderSearchBehaviour>.only: Builder<E, T, InAnyOrderOnlySearchBehaviour>
|
||||
@JvmName("butOnly")
|
||||
get() = ExpectImpl.iterable.contains.searchBehaviours.inAnyOrderOnly(this)
|
||||
|
||||
|
||||
/**
|
||||
* Defines that the search behaviour "find entries `in order` in the [Iterable]" shall be applied to this
|
||||
* sophisticated `contains` in [Iterable] assertion.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
val <E, T : Iterable<E>> Builder<E, T, NoOpSearchBehaviour>.inOrder: Builder<E, T, InOrderSearchBehaviour>
|
||||
get() = ExpectImpl.iterable.contains.searchBehaviours.inOrder(this)
|
||||
|
||||
/**
|
||||
* Defines that the constraint "`only` the specified entries exist in the [Iterable]" shall be applied to this
|
||||
* sophisticated `contains in order` [Iterable] assertion.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
val <E, T : Iterable<E>> Builder<E, T, InOrderSearchBehaviour>.only: Builder<E, T, InOrderOnlySearchBehaviour>
|
||||
@JvmName("andOnly")
|
||||
get() = ExpectImpl.iterable.contains.searchBehaviours.inOrderOnly(this)
|
||||
|
||||
/**
|
||||
* Defines that the [Iterable] contains `in order only` groups of entries
|
||||
* whereas the order within the group is specified as next step.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
val <E, T : Iterable<E>> Builder<E, T, InOrderOnlySearchBehaviour>.grouped: Builder<E, T, InOrderOnlyGroupedSearchBehaviour>
|
||||
get() = ExpectImpl.iterable.contains.searchBehaviours.inOrderOnlyGrouped(this)
|
||||
|
||||
/**
|
||||
* A filler word to emphasis that the next step defines the order within expected groups of values.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
val <E, T : Iterable<E>> Builder<E, T, InOrderOnlyGroupedSearchBehaviour>.within: Builder<E, T, InOrderOnlyGroupedWithinSearchBehaviour>
|
||||
get() = ExpectImpl.iterable.contains.searchBehaviours.inOrderOnlyGroupedWithin(this)
|
||||
@@ -1,11 +1,22 @@
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import org.spekframework.spek2.Spek
|
||||
import org.spekframework.spek2.style.specification.describe
|
||||
|
||||
class CharSequenceContainsRegexAssertionsSpec : Spek({
|
||||
include(StringSpec)
|
||||
include(RegexSpec)
|
||||
|
||||
describe("context 'aaaa'") {
|
||||
it("search for 'aa' finds 3 hits since we want non disjoint matches") {
|
||||
expect("aaaa").contains.exactly(3).regex("aa")
|
||||
}
|
||||
it("search for 'aa?' finds 4 hits since we want non disjoint matches") {
|
||||
expect("aaaa").contains.exactly(4).regex("aa?")
|
||||
}
|
||||
}
|
||||
}) {
|
||||
object StringSpec : ch.tutteli.atrium.specs.integration.CharSequenceContainsRegexAssertionsSpec(
|
||||
getNameContainsRegex(),
|
||||
|
||||
@@ -17,7 +17,7 @@ dependencies {
|
||||
}
|
||||
|
||||
|
||||
//TODO should not be necessary https://youtrack.jetbrains.com/issue/KT-28124
|
||||
//TODO 0.16.0 or 0.17.0 should not be necessary https://youtrack.jetbrains.com/issue/KT-28124
|
||||
compileTestKotlin.dependsOn(
|
||||
prefixedProject('core-robstoll-jvm').compileKotlin,
|
||||
prefixedProject('core-robstoll-jvm').processResources,
|
||||
|
||||
@@ -4,6 +4,4 @@ module ch.tutteli.atrium.api.fluent.en_GB {
|
||||
requires ch.tutteli.kbox;
|
||||
|
||||
exports ch.tutteli.atrium.api.fluent.en_GB;
|
||||
exports ch.tutteli.atrium.api.fluent.en_GB.creating.charsequence.contains.builders;
|
||||
exports ch.tutteli.atrium.api.fluent.en_GB.creating.iterable.contains.builders;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ dependencies {
|
||||
}
|
||||
|
||||
|
||||
//TODO should not be necessary https://youtrack.jetbrains.com/issue/KT-28124
|
||||
//TODO 0.16.0 or 0.17.0 should not be necessary https://youtrack.jetbrains.com/issue/KT-28124
|
||||
compileTestKotlin.dependsOn(
|
||||
prefixedProject('core-robstoll-jvm').compileKotlin,
|
||||
prefixedProject('core-robstoll-jvm').processResources,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//TODO remove both annotations with 1.0.0
|
||||
//TODO remove both annotations with 0.16.0
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceAssertionsKt")
|
||||
|
||||
@@ -9,7 +9,6 @@ import ch.tutteli.atrium.api.infix.en_GB.creating.RegexPatterns
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Values
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.logic.creating.typeutils.CharSequenceOrNumberOrChar
|
||||
import ch.tutteli.atrium.logic.*
|
||||
import ch.tutteli.atrium.logic.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceAssertionsKt")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.NotCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl.NotCheckerOptionImpl
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.NoOpSearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.NotSearchBehaviour
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Creates a [CharSequenceContains.Builder] based on this [Expect] which allows to define
|
||||
* a sophisticated `contains` assertion.
|
||||
*
|
||||
* @param o The filler object [o].
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
@Deprecated("Only here to retain binary backward compatibility; will be removed with 1.0.0")
|
||||
fun <T : CharSequence> contains(
|
||||
expect: Expect<T>,
|
||||
@Suppress("UNUSED_PARAMETER") o: o
|
||||
): CharSequenceContains.Builder<T, NoOpSearchBehaviour> = ExpectImpl.charSequence.containsBuilder(expect)
|
||||
|
||||
/**
|
||||
* Creates a [CharSequenceContains.Builder] based on this [Expect] which allows to define
|
||||
* more sophisticated `contains not` assertion.
|
||||
*
|
||||
* @param o The filler object [o].
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
@Deprecated("Only here to retain binary backward compatibility; will be removed with 1.0.0")
|
||||
fun <T : CharSequence> containsNot(
|
||||
expect: Expect<T>,
|
||||
@Suppress("UNUSED_PARAMETER") o: o
|
||||
): NotCheckerOption<T, NotSearchBehaviour> = NotCheckerOptionImpl(ExpectImpl.charSequence.containsNotBuilder(expect))
|
||||
@@ -1,97 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceContainsCheckersKt")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.*
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl.*
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains.SearchBehaviour
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the value which we are looking
|
||||
* for occurs `at least` number of [times] within the search input.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected value is
|
||||
* found in the input of the search.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
infix fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.Builder<T, S>.atLeast(
|
||||
times: Int
|
||||
): AtLeastCheckerOption<T, S> = AtLeastCheckerOptionImpl(times, this)
|
||||
|
||||
/**
|
||||
* Restricts a `contains at least` assertion by specifying that the number of occurrences of the value which we
|
||||
* are looking for occurs `at most` number of [times] within the search input.
|
||||
*
|
||||
* The resulting restriction will be a `contains at least but at most` assertion.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected value is
|
||||
* found in the input of the search.
|
||||
*
|
||||
* @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] of this `at most` restriction equals to the number of the
|
||||
* `at least` restriction; use the [exactly] restriction instead.
|
||||
*/
|
||||
infix fun <T : CharSequence, S : SearchBehaviour> AtLeastCheckerOption<T, S>.butAtMost(
|
||||
times: Int
|
||||
): ButAtMostCheckerOption<T, S> = ButAtMostCheckerOptionImpl(times, this, containsBuilder)
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the value which we
|
||||
* are looking for occurs `exactly` number of [times] within the search input.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected value is
|
||||
* found in the input of the search.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
infix fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.Builder<T, S>.exactly(
|
||||
times: Int
|
||||
): ExactlyCheckerOption<T, S> = ExactlyCheckerOptionImpl(times, this)
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the value which we
|
||||
* are looking for occurs `at least` once but `at most` number of [times] within the search input.
|
||||
*
|
||||
* If you want to use a higher lower bound than one, then use `atLeast(2).butAtMost(3)` instead of `atMost(3)`.
|
||||
* And in case you want to state that it is either not contained at all or at most a certain number of times,
|
||||
* then use `notOrAtMost(2)` instead.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected value is
|
||||
* found in the input of the search.
|
||||
*
|
||||
* @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 one; use [exactly] instead.
|
||||
*/
|
||||
infix fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.Builder<T, S>.atMost(
|
||||
times: Int
|
||||
): AtMostCheckerOption<T, S> = AtMostCheckerOptionImpl(times, this)
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the value which we
|
||||
* are looking for occurs `not at all or at most` number of [times] within the search input.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected value is
|
||||
* found in the input of the search.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
infix fun <T : CharSequence, S : SearchBehaviour> CharSequenceContains.Builder<T, S>.notOrAtMost(
|
||||
times: Int
|
||||
): NotOrAtMostCheckerOption<T, S> = NotOrAtMostCheckerOptionImpl(times, this)
|
||||
@@ -1,506 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceContainsCreatorsKt")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.All
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.RegexPatterns
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Values
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.builders.creating.basic.contains.addAssertion
|
||||
import ch.tutteli.atrium.domain.builders.utils.toVarArg
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains.Builder
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains.CheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.IgnoringCaseSearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.NoOpSearchBehaviour
|
||||
import ch.tutteli.atrium.logic.creating.typeutils.CharSequenceOrNumberOrChar
|
||||
import ch.tutteli.atrium.logic.creating.typeutils.IterableLike
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected] object shall be searched,
|
||||
* using a non disjoint search.
|
||||
*
|
||||
* Delegates to `the values(expected)`.
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expected] is not a [CharSequence], [Number] or [Char].
|
||||
*/
|
||||
infix fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.value(
|
||||
expected: CharSequenceOrNumberOrChar
|
||||
): Expect<T> = this the values(expected)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given [values]
|
||||
* shall be searched, using a non disjoint search.
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"a"` and
|
||||
* [Values] is defined as `values("a", "a")`, then both match,
|
||||
* even though they match the same sequence in the input of the search.
|
||||
* Use an option such as [atLeast], [atMost] and [exactly] to control the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains o exactly 2 the value "a"`
|
||||
* instead of:
|
||||
* `contains o atLeast 1 the values("a", "a")`
|
||||
*
|
||||
* @param values The values which should not be found within the input of the search
|
||||
* -- use the function `values(t, ...)` to create a [Values].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case one of the [values] is not a [CharSequence], [Number] or [Char].
|
||||
*/
|
||||
infix fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.the(
|
||||
values: Values<CharSequenceOrNumberOrChar>
|
||||
): Expect<T> = addAssertion(ExpectImpl.charSequence.contains.values(this, values.toList()))
|
||||
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected] value shall be searched
|
||||
* (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `the values(expected)`.
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expected] is not a [CharSequence], [Number] or [Char].
|
||||
*/
|
||||
@JvmName("valueIgnoringCase")
|
||||
infix fun <T : CharSequence> CheckerOption<T, IgnoringCaseSearchBehaviour>.value(
|
||||
expected: CharSequenceOrNumberOrChar
|
||||
): Expect<T> = this the values(expected)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [values]
|
||||
* shall be searched (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"a"` and
|
||||
* [Values] is defined as `values("a", "a")`, then both match,
|
||||
* even though they match the same sequence in the input of the search.
|
||||
* Use an option such as [atLeast], [atMost] and [exactly] to control the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains o ignoring case exactly 2 the value "a"`
|
||||
* instead of:
|
||||
* `contains o ignoring case atLeast 1 the values("a", "a")`
|
||||
*
|
||||
* @param values The values which are expected to be contained within the input of the search
|
||||
* -- use the function `values(t, ...)` to create a [Values].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case one of the [values] is not a [CharSequence], [Number] or [Char].
|
||||
*/
|
||||
@JvmName("valuesIgnoringCase")
|
||||
infix fun <T : CharSequence> CheckerOption<T, IgnoringCaseSearchBehaviour>.the(
|
||||
values: Values<CharSequenceOrNumberOrChar>
|
||||
): Expect<T> = addAssertion(ExpectImpl.charSequence.contains.valuesIgnoringCase(this, values.toList()))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected] value shall be searched
|
||||
* (ignoring case), using a non disjoint search where it needs to be contained at least once.
|
||||
*
|
||||
* Delegates to `atLeast 1 value expected`.
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expected] is not a [CharSequence], [Number] or [Char].
|
||||
*/
|
||||
infix fun <T : CharSequence> Builder<T, IgnoringCaseSearchBehaviour>.value(
|
||||
expected: CharSequenceOrNumberOrChar
|
||||
): Expect<T> = this atLeast 1 value expected
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [values]
|
||||
* shall be searched (ignoring case), using a non disjoint search
|
||||
* where each need to be contained at least once.
|
||||
*
|
||||
* Delegates to `atLeast 1 the value`.
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"a"` and
|
||||
* [Values] is defined as `values("a", "a")`, then both match,
|
||||
* even though they match the same sequence in the input of the search.
|
||||
* Use an option such as [atLeast], [atMost] and [exactly] to control the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains o ignoring case exactly 2 the value "a"`
|
||||
* instead of:
|
||||
* `contains o ignoring case atLeast 1 the values("a", "a")`
|
||||
*
|
||||
* @param values The values which are expected to be contained within the input of the search
|
||||
* -- use the function `values(t, ...)` to create a [Values].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case one of the [values] is not a [CharSequence], [Number] or [Char].
|
||||
*/
|
||||
infix fun <T : CharSequence> Builder<T, IgnoringCaseSearchBehaviour>.the(
|
||||
values: Values<CharSequenceOrNumberOrChar>
|
||||
): Expect<T> = this atLeast 1 the values
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given regular expression [pattern]
|
||||
* is expected to have a match, using a non disjoint search.
|
||||
*
|
||||
* Delegates to `the regexPatterns(pattern)`.
|
||||
*
|
||||
* @param pattern The pattern which is expected to have a match against the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.regex(pattern: String): Expect<T> =
|
||||
this the regexPatterns(pattern)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given [Regex] [pattern]
|
||||
* is expected to have a match.
|
||||
*
|
||||
* Delegates to `matchFor all(pattern)`
|
||||
*
|
||||
* @param pattern The pattern which is expected to have a match against the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*
|
||||
* @since 0.12.0
|
||||
*/
|
||||
infix fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.matchFor(
|
||||
pattern: Regex
|
||||
): Expect<T> = this matchFor all(pattern)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given regular expression [patterns]
|
||||
* are expected to have a match, using a non disjoint search.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"ab"` and
|
||||
* [RegexPatterns] is defined as `regexPatterns("a(b)?", "a(b)?")` as well, then both match,
|
||||
* even though they match the same sequence in the input of the search.
|
||||
* Use an option such as [atLeast], [atMost] and [exactly] to control the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains o exactly 2 regex "a(b)?"`
|
||||
* instead of:
|
||||
* `contains o atLeast 1 the regexPatterns("a(b)?", "a(b)?")`
|
||||
*
|
||||
* @param patterns The patterns which are expected to have a match against the input of the search
|
||||
* -- use the function `regexPatterns(t, ...)` to create a [RegexPatterns].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.the(patterns: RegexPatterns): Expect<T> =
|
||||
addAssertion(ExpectImpl.charSequence.contains.regex(this, patterns.toList()))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given [Regex] [patterns]
|
||||
* are expected to have a match, using a non disjoint search.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"ab"` and
|
||||
* [All] is defined as `all(Regex("a(b)?"), Regex("a(b)?"))` as well, then both match,
|
||||
* even though they match the same sequence in the input of the search.
|
||||
* Use an option such as [atLeast], [atMost] and [exactly] to control the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains o exactly 2 regex "a(b)?"`
|
||||
* instead of:
|
||||
* `contains o atLeast 1 the all(Regex("a(b)?"), Regex("a(b)?"))`
|
||||
*
|
||||
* @param patterns The patterns which are expected to have a match against the input of the search --
|
||||
* use the function `all(Regex(...), ...)` to create a [All].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*
|
||||
* @since 0.12.0
|
||||
*/
|
||||
infix fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.matchFor(patterns: All<Regex>): Expect<T> =
|
||||
addAssertion(ExpectImpl.charSequence.contains.regex(this, patterns.toList()))
|
||||
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given regular expression [pattern]
|
||||
* is expected to have a match (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `the regexPatterns(pattern)`.
|
||||
*
|
||||
* @param pattern The patterns which is expected to have a match against the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
@JvmName("regexIgnoringCase")
|
||||
infix fun <T : CharSequence> CheckerOption<T, IgnoringCaseSearchBehaviour>.regex(pattern: String): Expect<T> =
|
||||
this the regexPatterns(pattern)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given regular expression [patterns]
|
||||
* are expected to have a match (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"ab"` and
|
||||
* [RegexPatterns] is defined as `regexPatterns("a(b)?", "a(b)?")` as well, then both match,
|
||||
* even though they match the same sequence in the input of the search.
|
||||
* Use an option such as [atLeast], [atMost] and [exactly] to control the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains o ignoring case exactly 2 the regex "a(b)?"`
|
||||
* instead of:
|
||||
* `contains o ignoring case atLeast 1 the regexPatterns("a(b)?", "a(b)?")`
|
||||
*
|
||||
* @param patterns The patterns which are expected to have a match against the input of the search
|
||||
* -- use the function `regexPatterns(t, ...)` to create a [RegexPatterns].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
@JvmName("regexIgnoringCase")
|
||||
infix fun <T : CharSequence> CheckerOption<T, IgnoringCaseSearchBehaviour>.the(patterns: RegexPatterns): Expect<T> =
|
||||
addAssertion(ExpectImpl.charSequence.contains.regexIgnoringCase(this, patterns.toList()))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given regular expression [pattern]
|
||||
* is expected to have at least one match (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `atLeast 1 regex pattern`.
|
||||
*
|
||||
* @param pattern The patterns which is expected to have a match against the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <T : CharSequence> Builder<T, IgnoringCaseSearchBehaviour>.regex(pattern: String): Expect<T> =
|
||||
this atLeast 1 regex pattern
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the given regular expression [patterns]
|
||||
* are expected to have at least one match (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `atLeast 1 the patterns`.
|
||||
*
|
||||
* By non disjoint is meant that `"aa"` in `"aaaa"` is found three times and not only two times.
|
||||
* Also notice, that it does not search for unique matches. Meaning, if the input of the search is `"ab"` and
|
||||
* [RegexPatterns] is defined as `regexPatterns("a(b)?", "a(b)?")` as well, then both match,
|
||||
* even though they match the same sequence in the input of the search.
|
||||
* Use an option such as [atLeast], [atMost] and [exactly] to control the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `contains o ignoring case exactly 2 the regex "a(b)?"`
|
||||
* instead of:
|
||||
* `contains o ignoring case atLeast 1 the RegexPatterns("a(b)?", "a(b)?")`
|
||||
*
|
||||
* @param patterns The patterns which are expected to have a match against the input of the search --
|
||||
* use the function `regexPatterns(t, ...)` to create a [RegexPatterns].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <T : CharSequence> Builder<T, IgnoringCaseSearchBehaviour>.the(patterns: RegexPatterns): Expect<T> =
|
||||
this atLeast 1 the patterns
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterable]
|
||||
* shall be searched, using a non disjoint search.
|
||||
*
|
||||
* Delegates to `the values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray())`
|
||||
* (see [the] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expectedIterable The [Iterable] whose elements are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterable] is not a [CharSequence], [Number] or [Char] or the given
|
||||
* [expectedIterable] does not have elements (is empty).
|
||||
*
|
||||
* TODO remove with 1.0.0
|
||||
* @since 0.12.0
|
||||
*/
|
||||
infix fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.elementsOf(
|
||||
expectedIterable: Iterable<CharSequenceOrNumberOrChar>
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<CharSequenceOrNumberOrChar>(expectedIterable)
|
||||
return this the Values(first, rest)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterable]
|
||||
* shall be searched (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `the values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray())`
|
||||
* (see [the] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expectedIterable The [Iterable] whose elements are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterable] is not a [CharSequence], [Number] or [Char] or the given
|
||||
* [expectedIterable] does not have elements (is empty).
|
||||
*
|
||||
* TODO remove with 1.0.0
|
||||
* @since 0.12.0
|
||||
*/
|
||||
@JvmName("elementsOfIgnoringCase")
|
||||
infix fun <T : CharSequence> CheckerOption<T, IgnoringCaseSearchBehaviour>.elementsOf(
|
||||
expectedIterable: Iterable<CharSequenceOrNumberOrChar>
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<CharSequenceOrNumberOrChar>(expectedIterable)
|
||||
return this the Values(first, rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterable]
|
||||
* shall be searched (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `the values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray())`
|
||||
* (see [the] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed.
|
||||
* This function expects [CharSequenceOrNumberOrChar] (which is a typealias for [Any]) for your convenience,
|
||||
* so that you can mix [String] and [Int] for instance.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expectedIterable The [Iterable] whose elements are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterable] is not a [CharSequence], [Number] or [Char] or the given
|
||||
* [expectedIterable] does not have elements (is empty).
|
||||
*
|
||||
* TODO remove with 1.0.0
|
||||
* @since 0.12.0
|
||||
*/
|
||||
@JvmName("elementsOfIgnoringCase")
|
||||
infix fun <T : CharSequence> Builder<T, IgnoringCaseSearchBehaviour>.elementsOf(
|
||||
expectedIterable: Iterable<CharSequenceOrNumberOrChar>
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<CharSequenceOrNumberOrChar>(expectedIterable)
|
||||
return this the Values(first, rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterableLike]
|
||||
* shall be searched, using a non disjoint search.
|
||||
*
|
||||
* Delegates to `the values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray())`
|
||||
* (see [the] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [Iterable], [Sequence] or one of the [Array] types
|
||||
* are passed. This function expects [IterableLike] (which is a typealias for [Any]) to avoid cluttering the API.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expectedIterableLike The [IterableLike] whose elements are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types or the given
|
||||
* [expectedIterableLike] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.13.0
|
||||
*/
|
||||
infix fun <T : CharSequence> CheckerOption<T, NoOpSearchBehaviour>.elementsOf(
|
||||
expectedIterableLike: IterableLike
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<CharSequenceOrNumberOrChar>(expectedIterableLike)
|
||||
return this the Values(first, rest)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterableLike]
|
||||
* shall be searched (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `the values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray())`
|
||||
* (see [the] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [Iterable], [Sequence] or one of the [Array] types
|
||||
* are passed. This function expects [IterableLike] (which is a typealias for [Any]) to avoid cluttering the API.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expectedIterableLike The [IterableLike] whose elements are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types or the given
|
||||
* [expectedIterableLike] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.13.0
|
||||
*/
|
||||
@JvmName("elementsOfIgnoringCase")
|
||||
infix fun <T : CharSequence> CheckerOption<T, IgnoringCaseSearchBehaviour>.elementsOf(
|
||||
expectedIterableLike: IterableLike
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<CharSequenceOrNumberOrChar>(expectedIterableLike)
|
||||
return this the Values(first, rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterableLike]
|
||||
* shall be searched (ignoring case), using a non disjoint search.
|
||||
*
|
||||
* Delegates to `the values(expectedIterable.first(), *expectedIterable.drop(1).toTypedArray())`
|
||||
* (see [the] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [Iterable], [Sequence] or one of the [Array] types
|
||||
* are passed. This function expects [IterableLike] (which is a typealias for [Any]) to avoid cluttering the API.
|
||||
*
|
||||
* By non disjoint is meant that "aa" in "aaaa" is found three times and not only two times.
|
||||
*
|
||||
* @param expectedIterableLike The [IterableLike] whose elements are expected to be contained within the input of the search.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types or the given
|
||||
* [expectedIterableLike] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.13.0
|
||||
*/
|
||||
@JvmName("elementsOfIgnoringCase")
|
||||
infix fun <T : CharSequence> Builder<T, IgnoringCaseSearchBehaviour>.elementsOf(
|
||||
expectedIterableLike: IterableLike
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<CharSequenceOrNumberOrChar>(expectedIterableLike)
|
||||
return this the Values(first, rest)
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceContainsSearchBehavioursKt")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.NotCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl.NotCheckerOptionImpl
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.IgnoringCaseSearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.NoOpSearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.searchbehaviours.NotSearchBehaviour
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Defines that the search behaviour `ignore case` shall be applied to this sophisticated `contains` assertion.
|
||||
*
|
||||
* @param case Has to be `case`.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
infix fun <T : CharSequence> CharSequenceContains.Builder<T, NoOpSearchBehaviour>.ignoring(
|
||||
@Suppress("UNUSED_PARAMETER") case: case
|
||||
): CharSequenceContains.Builder<T, IgnoringCaseSearchBehaviour> =
|
||||
ExpectImpl.charSequence.contains.searchBehaviours.ignoringCase(this)
|
||||
|
||||
/**
|
||||
* Defines that the search behaviour `ignore case` shall be applied to this sophisticated `contains not` assertion.
|
||||
*
|
||||
* @param case Has to be `case`.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
infix fun <T : CharSequence> NotCheckerOption<T, NotSearchBehaviour>.ignoring(
|
||||
@Suppress("UNUSED_PARAMETER") case: case
|
||||
): NotCheckerOption<T, IgnoringCaseSearchBehaviour> =
|
||||
NotCheckerOptionImpl(containsBuilder ignoring case)
|
||||
@@ -1,21 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.WithTimesCheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains at least`-check within a sophisticated
|
||||
* `contains` assertion building process for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use AtLeastCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.charsequence.contains.steps.AtLeastCheckerStep")
|
||||
)
|
||||
interface AtLeastCheckerOption<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>
|
||||
: WithTimesCheckerOption<T, S>
|
||||
@@ -1,20 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains at least once but at most`-check within
|
||||
* a sophisticated `contains` assertion building process for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use AtMostCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.charsequence.contains.steps.AtMostCheckerStep")
|
||||
)
|
||||
interface AtMostCheckerOption<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>
|
||||
: CharSequenceContains.CheckerOption<T, S>
|
||||
@@ -1,20 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains at least but at most`-check within
|
||||
* a sophisticated `contains` assertion building process for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use ButAtMostCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.charsequence.contains.steps.ButAtMostCheckerStep")
|
||||
)
|
||||
interface ButAtMostCheckerOption<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>
|
||||
: CharSequenceContains.CheckerOption<T, S>
|
||||
@@ -1,20 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains exactly`-check within
|
||||
* a sophisticated `contains` assertion building process for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use ExactlyCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.charsequence.contains.steps.ExactlyCheckerStep")
|
||||
)
|
||||
interface ExactlyCheckerOption<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>
|
||||
: CharSequenceContains.CheckerOption<T, S>
|
||||
@@ -1,20 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains not at all`-check within
|
||||
* a sophisticated `contains` assertion building process for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use NotCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.charsequence.contains.steps.NotCheckerStep")
|
||||
)
|
||||
interface NotCheckerOption<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>
|
||||
: CharSequenceContains.CheckerOption<T, S>
|
||||
@@ -1,20 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains not or at most`-check within
|
||||
* a sophisticated `contains` assertion building process for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use NotOrAtMostCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.charsequence.contains.steps.NotOrAtMostCheckerStep")
|
||||
)
|
||||
interface NotOrAtMostCheckerOption<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>
|
||||
: CharSequenceContains.CheckerOption<T, S>
|
||||
@@ -1,32 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.AtLeastCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.AtLeastCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains at least`-check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains at least` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [CharSequence].
|
||||
* @param times The number which the check will compare against the actual number of times an expected object is
|
||||
* found in the input of the search.
|
||||
* @param containsBuilder The previously used [CharSequenceContains.Builder].
|
||||
*/
|
||||
internal class AtLeastCheckerOptionImpl<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: CharSequenceContains.Builder<T, S>
|
||||
) : AtLeastCheckerOptionBase<T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "`atLeast $it`" }
|
||||
), AtLeastCheckerOption<T, S>
|
||||
@@ -1,34 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.AtMostCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.AtMostCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains at least once but at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains at least once but at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [CharSequence].
|
||||
* @param times The number which the check will compare against the actual number of times an expected object is
|
||||
* found in the input of the search.
|
||||
* @param containsBuilder The previously used [CharSequenceContains.Builder].
|
||||
*/
|
||||
internal class AtMostCheckerOptionImpl<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: CharSequenceContains.Builder<T, S>
|
||||
) : AtMostCheckerOptionBase<T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "`atMost $it`" },
|
||||
{ "`atLeast $it`" },
|
||||
{ "`exactly $it`" }
|
||||
), AtMostCheckerOption<T, S>
|
||||
@@ -1,43 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.atLeast
|
||||
import ch.tutteli.atrium.api.infix.en_GB.atMost
|
||||
import ch.tutteli.atrium.api.infix.en_GB.butAtMost
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.AtLeastCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.ButAtMostCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.api.infix.en_GB.exactly
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.ButAtMostCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the builder of the second step of a `contains at least but at most` check within the
|
||||
* fluent API of a sophisticated `contains` assertion for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied to the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of the second step of a `contains at least but at most` check within the
|
||||
* fluent API of a sophisticated `contains` assertion for [CharSequence].
|
||||
* @param times The number which the check will compare against the actual number of times an expected object is
|
||||
* found in the input of the search.
|
||||
* @param containsBuilder The previously used [CharSequenceContains.Builder].
|
||||
*/
|
||||
internal class ButAtMostCheckerOptionImpl<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>(
|
||||
times: Int,
|
||||
atLeastBuilder: AtLeastCheckerOption<T, S>,
|
||||
containsBuilder: CharSequenceContains.Builder<T, S>
|
||||
) : ButAtMostCheckerOptionBase<T, S>(
|
||||
times,
|
||||
atLeastBuilder,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ l, u -> "`atLeast $l butAtMost $u`" },
|
||||
{ "`atMost $it`" },
|
||||
{ "`atLeast $it`" },
|
||||
{ "`butAtMost $it`" },
|
||||
{ "`exactly $it`" }
|
||||
), ButAtMostCheckerOption<T, S>
|
||||
@@ -1,33 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.ExactlyCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.api.infix.en_GB.exactly
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.ExactlyCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains exactly` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains exactly` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [CharSequence].
|
||||
* @param times The number which the check will compare against the actual number of times an expected object is
|
||||
* found in the input of the search.
|
||||
* @param containsBuilder The previously used [CharSequenceContains.Builder].
|
||||
*/
|
||||
internal class ExactlyCheckerOptionImpl<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: CharSequenceContains.Builder<T, S>
|
||||
) : ExactlyCheckerOptionBase<T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "`exactly $it`" }
|
||||
), ExactlyCheckerOption<T, S>
|
||||
@@ -1,24 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.NotCheckerOption
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.NotCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains not at all` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains not at all` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [CharSequence].
|
||||
* @param containsBuilder The previously used [CharSequenceContains.Builder].
|
||||
*/
|
||||
internal class NotCheckerOptionImpl<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>(
|
||||
containsBuilder: CharSequenceContains.Builder<T, S>
|
||||
) : NotCheckerOptionBase<T, S>(containsBuilder),
|
||||
NotCheckerOption<T, S>
|
||||
@@ -1,33 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.NotOrAtMostCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.api.infix.en_GB.notOrAtMost
|
||||
import ch.tutteli.atrium.domain.builders.creating.charsequence.contains.builders.NotOrAtMostCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.charsequence.contains.CharSequenceContains
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains not or at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [CharSequence].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains not or at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [CharSequence].
|
||||
* @param times The number which the check will compare against the actual number of times an expected object is
|
||||
* found in the input of the search.
|
||||
* @param containsBuilder The previously used [CharSequenceContains.Builder].
|
||||
*/
|
||||
internal class NotOrAtMostCheckerOptionImpl<out T : CharSequence, out S : CharSequenceContains.SearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: CharSequenceContains.Builder<T, S>
|
||||
) : NotOrAtMostCheckerOptionBase<T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "`notOrAtMost $it`" }
|
||||
), NotOrAtMostCheckerOption<T, S>
|
||||
@@ -1,18 +0,0 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Values
|
||||
import ch.tutteli.atrium.api.infix.en_GB.containsNot
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import kotlin.reflect.KFunction2
|
||||
|
||||
internal object StaticName {
|
||||
val nameContainsNotValuesFun: String = {
|
||||
val f: KFunction2<Expect<CharSequence>, Values<Any>, Expect<CharSequence>> =
|
||||
Expect<CharSequence>::containsNot
|
||||
//TODO use once https://youtrack.jetbrains.com/issue/KT-38013 is fixed (there are other places where "values" is hard-coded)
|
||||
// val values : KFunction2<Int, Array<out Int>, Values<Int>> = ::values
|
||||
// "`${f.name} ${values.name}`"
|
||||
"`${f.name} values`"
|
||||
}()
|
||||
}
|
||||
@@ -8,14 +8,14 @@ import ch.tutteli.atrium.logic.creating.charsequence.contains.steps.AtLeastCheck
|
||||
import kotlin.reflect.KFunction2
|
||||
|
||||
internal object StaticName {
|
||||
val containsNotValuesFun: String = {
|
||||
val containsNotValuesFun: String = run {
|
||||
val f: KFunction2<Expect<CharSequence>, Values<Any>, Expect<CharSequence>> =
|
||||
Expect<CharSequence>::containsNot
|
||||
//TODO use once https://youtrack.jetbrains.com/issue/KT-38013 is fixed (there are other places where "values" is hard-coded)
|
||||
// val values : KFunction2<Int, Array<out Int>, Values<Int>> = ::values
|
||||
// "`${f.name} ${values.name}`"
|
||||
"`${f.name} values`"
|
||||
}()
|
||||
}
|
||||
|
||||
val atLeast = CharSequenceContains.EntryPointStep<*, *>::atLeast.name
|
||||
val butAtMost = AtLeastCheckerStep<*, *>::butAtMost.name
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.WithTimesCheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains at least`-check within a sophisticated
|
||||
* `contains` assertion building process for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use AtLeastCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.iterable.contains.steps.AtLeastCheckerStep")
|
||||
)
|
||||
interface AtLeastCheckerOption<out E, out T : Iterable<E>, out S : IterableContains.SearchBehaviour>
|
||||
: WithTimesCheckerOption<E, T, S>
|
||||
@@ -1,21 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.WithTimesCheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains at least once but at most`-check within
|
||||
* a sophisticated `contains` assertion building process for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use AtMostCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.iterable.contains.steps.AtMostCheckerStep")
|
||||
)
|
||||
interface AtMostCheckerOption<out E, out T : Iterable<E>, out S : IterableContains.SearchBehaviour>
|
||||
: WithTimesCheckerOption<E, T, S>
|
||||
@@ -1,21 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.WithTimesCheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains at least but at most`-check within a
|
||||
* sophisticated `contains` assertion building process for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use ButAtMostCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.iterable.contains.steps.ButAtMostCheckerStep")
|
||||
)
|
||||
interface ButAtMostCheckerOption<out E, out T : Iterable<E>, out S : IterableContains.SearchBehaviour>
|
||||
: WithTimesCheckerOption<E, T, S>
|
||||
@@ -1,21 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.WithTimesCheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains exactly`-check within
|
||||
* a sophisticated `contains` assertion building process for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use ExactlyCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.iterable.contains.steps.ExactlyCheckerStep")
|
||||
)
|
||||
interface ExactlyCheckerOption<out E, out T : Iterable<E>, out S : IterableContains.SearchBehaviour>
|
||||
: WithTimesCheckerOption<E, T, S>
|
||||
@@ -1,20 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains not at all`-check within
|
||||
* a sophisticated `contains` assertion building process for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use NotCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.iterable.contains.steps.NotCheckerStep")
|
||||
)
|
||||
interface NotCheckerOption<out E, out T : Iterable<E>, out S : IterableContains.SearchBehaviour>
|
||||
: IterableContains.CheckerOption<E, T, S>
|
||||
@@ -1,21 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.WithTimesCheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
|
||||
/**
|
||||
* Represents the extension point for another option after a `contains not or at most`-check within
|
||||
* a sophisticated `contains` assertion building process for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use NotOrAtMostCheckerStep from atrium-logic; will be removed with 1.0.0",
|
||||
ReplaceWith("ch.tutteli.atrium.logic.creating.iterable.contains.steps.NotOrAtMostCheckerStep")
|
||||
)
|
||||
interface NotOrAtMostCheckerOption<out E, out T : Iterable<E>, out S : IterableContains.SearchBehaviour>
|
||||
: WithTimesCheckerOption<E, T, S>
|
||||
@@ -1,32 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.AtLeastCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.AtLeastCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains at least` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains at least` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [Iterable].
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
* @param containsBuilder The previously used [IterableContains.Builder].
|
||||
*/
|
||||
internal class AtLeastCheckerOptionImpl<out E, out T : Iterable<E>, out S : InAnyOrderSearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: IterableContains.Builder<E, T, S>
|
||||
) : AtLeastCheckerOptionBase<E, T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "`atLeast $it`" }
|
||||
), AtLeastCheckerOption<E, T, S>
|
||||
@@ -1,34 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.AtMostCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.AtMostCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains at least once but at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains at least once but at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [Iterable].
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
* @param containsBuilder The previously used [IterableContains.Builder].
|
||||
*/
|
||||
internal class AtMostCheckerOptionImpl<out E, out T : Iterable<E>, out S : InAnyOrderSearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: IterableContains.Builder<E, T, S>
|
||||
) : AtMostCheckerOptionBase<E, T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "`atMost $it`" },
|
||||
{ "`atLeast $it`" },
|
||||
{ "`exactly $it`" }
|
||||
), AtMostCheckerOption<E, T, S>
|
||||
@@ -1,39 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.AtLeastCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.ButAtMostCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.ButAtMostCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Represents the builder of the second step of a `contains at least but at most` check within the
|
||||
* fluent API of a sophisticated `contains` assertion for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
*
|
||||
* @constructor Represents the builder of the second step of a `contains at least but at most` check within the
|
||||
* fluent API of a sophisticated `contains` assertion for [Iterable].
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
* @param containsBuilder The previously used [IterableContains.Builder].
|
||||
*/
|
||||
internal class ButAtMostCheckerOptionImpl<out E, out T : Iterable<E>, out S : InAnyOrderSearchBehaviour>(
|
||||
times: Int,
|
||||
atLeastBuilder: AtLeastCheckerOption<E, T, S>,
|
||||
containsBuilder: IterableContains.Builder<E, T, S>
|
||||
) : ButAtMostCheckerOptionBase<E, T, S>(
|
||||
times,
|
||||
atLeastBuilder,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ l, u -> "`atLeast $l butAtMost $u`" },
|
||||
{ "`atMost $it`" },
|
||||
{ "`atLeast $it`" },
|
||||
{ "`butAtMost $it`" },
|
||||
{ "`exactly $it`" }
|
||||
), ButAtMostCheckerOption<E, T, S>
|
||||
@@ -1,32 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.ExactlyCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.ExactlyCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains exactly` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains exactly` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [Iterable].
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
* @param containsBuilder The previously used [IterableContains.Builder].
|
||||
*/
|
||||
internal class ExactlyCheckerOptionImpl<out E, out T : Iterable<E>, out S : InAnyOrderSearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: IterableContains.Builder<E, T, S>
|
||||
) : ExactlyCheckerOptionBase<E, T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "`exactly $it`" }
|
||||
), ExactlyCheckerOption<E, T, S>
|
||||
@@ -1,25 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.NotCheckerOption
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.NotCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains not at all` check within the fluent API of a sophisticated
|
||||
* `contains` assertion for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
* @param S The search behaviour which should be applied for the input of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains not at all` check within the fluent API of a sophisticated
|
||||
* `contains not` assertion for [Iterable].
|
||||
* @param containsBuilder The previously used [IterableContains.Builder].
|
||||
*/
|
||||
internal class NotCheckerOptionImpl<out E, out T : Iterable<E>, out S : InAnyOrderSearchBehaviour>(
|
||||
containsBuilder: IterableContains.Builder<E, T, S>
|
||||
) : NotCheckerOptionBase<E, T, S>(containsBuilder),
|
||||
NotCheckerOption<E, T, S>
|
||||
@@ -1,32 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.NotOrAtMostCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl.StaticName.nameContainsNotValuesFun
|
||||
import ch.tutteli.atrium.domain.builders.creating.iterable.contains.builders.NotOrAtMostCheckerOptionBase
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Represents the builder of a `contains not or at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [Iterable].
|
||||
*
|
||||
* @param T The input type of the search.
|
||||
*
|
||||
* @constructor Represents the builder of a `contains at least once but at most` check within the fluent API of a
|
||||
* sophisticated `contains` assertion for [Iterable].
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
* @param containsBuilder The previously used [IterableContains.Builder].
|
||||
*/
|
||||
internal class NotOrAtMostCheckerOptionImpl<out E, out T : Iterable<E>, out S : InAnyOrderSearchBehaviour>(
|
||||
times: Int,
|
||||
containsBuilder: IterableContains.Builder<E, T, S>
|
||||
) : NotOrAtMostCheckerOptionBase<E, T, S>(
|
||||
times,
|
||||
containsBuilder,
|
||||
nameContainsNotValuesFun,
|
||||
{ "`notOrAtMost $it`" }
|
||||
), NotOrAtMostCheckerOption<E, T, S>
|
||||
@@ -1,8 +0,0 @@
|
||||
//TODO remove with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl
|
||||
|
||||
internal object StaticName {
|
||||
val nameContainsNotValuesFun: String = "`containsNot values`"
|
||||
}
|
||||
@@ -10,14 +10,14 @@ import ch.tutteli.atrium.logic.creating.iterable.contains.steps.NotCheckerStep
|
||||
import kotlin.reflect.KFunction2
|
||||
|
||||
internal object StaticName {
|
||||
val containsNotValuesFun = {
|
||||
val containsNotValuesFun = run {
|
||||
val containsNotKf: KFunction2<Expect<Iterable<Double>>, o, NotCheckerStep<Double, Iterable<Double>, NotSearchBehaviour>> =
|
||||
Expect<Iterable<Double>>::containsNot
|
||||
//TODO use once https://youtrack.jetbrains.com/issue/KT-38013 is fixed (there are other places where "values" is hard-coded)
|
||||
// val values : KFunction2<Int, Array<out Int>, Values<Int>> = ::values
|
||||
// "`${f.name} ${o::class.simpleName} ${fThe.name} ${values.name}`"
|
||||
"`${containsNotKf.name} values`"
|
||||
}()
|
||||
}
|
||||
|
||||
val atLeast = IterableLikeContains.EntryPointStep<*, *, InAnyOrderSearchBehaviour>::atLeast.name
|
||||
val butAtMost = AtLeastCheckerStep<*, *, InAnyOrderSearchBehaviour>::butAtMost.name
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("IterableAssertionsKt")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.NotCheckerOption
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl.NotCheckerOptionImpl
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.NoOpSearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.NotSearchBehaviour
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Creates an [IterableContains.Builder] based on this [Expect] which allows to define
|
||||
* more sophisticated `contains` assertions.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
@Deprecated("Only here to retain binary backward compatibility; will be removed with 1.0.0")
|
||||
fun <E, T : Iterable<E>> contains(
|
||||
expect: Expect<T>,
|
||||
@Suppress("UNUSED_PARAMETER") o: o
|
||||
): IterableContains.Builder<E, T, NoOpSearchBehaviour> =
|
||||
ExpectImpl.iterable.containsBuilder(expect)
|
||||
|
||||
/**
|
||||
* Creates an [IterableContains.Builder] based on this [Expect] which allows to define
|
||||
* more sophisticated `contains not` assertions.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
@Deprecated("Only here to retain binary backward compatibility; will be removed with 1.0.0")
|
||||
fun <E, T : Iterable<E>> containsNot(
|
||||
expect: Expect<T>,
|
||||
@Suppress("UNUSED_PARAMETER") o: o
|
||||
): NotCheckerOption<E, T, NotSearchBehaviour> =
|
||||
NotCheckerOptionImpl(ExpectImpl.iterable.containsNotBuilder(expect))
|
||||
@@ -1,93 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.*
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders.impl.*
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the entry which we are looking
|
||||
* for occurs `at least` number of [times] within the [Iterable].
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>, S : InAnyOrderSearchBehaviour> IterableContains.Builder<E, T, S>.atLeast(
|
||||
times: Int
|
||||
): AtLeastCheckerOption<E, T, S> = AtLeastCheckerOptionImpl(times, this)
|
||||
|
||||
/**
|
||||
* Restricts a `contains at least` assertion by specifying that the number of occurrences of the entry which we
|
||||
* are looking for occurs `at most` number of [times] within the [Iterable].
|
||||
*
|
||||
* The resulting restriction will be a `contains at least but at most` assertion.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
*
|
||||
* @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] of this `at most` restriction equals to the number of the
|
||||
* `at least` restriction; use the [exactly] restriction instead.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>, S : InAnyOrderSearchBehaviour> AtLeastCheckerOption<E, T, S>.butAtMost(
|
||||
times: Int
|
||||
): ButAtMostCheckerOption<E, T, S> = ButAtMostCheckerOptionImpl(times, this, containsBuilder)
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the entry which we
|
||||
* are looking for occurs `exactly` number of [times] within the [Iterable].
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>, S : InAnyOrderSearchBehaviour> IterableContains.Builder<E, T, S>.exactly(
|
||||
times: Int
|
||||
): ExactlyCheckerOption<E, T, S> = ExactlyCheckerOptionImpl(times, this)
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the entry which we
|
||||
* are looking for occurs `at least` once but `at most` number of [times] within the [Iterable].
|
||||
*
|
||||
* If you want to use a higher lower bound than one, then use `atLeast(2).butAtMost(3)` instead of `atMost(3)`.
|
||||
* And in case you want to state that it is either not contained at all or at most a certain number of times,
|
||||
* then use `notOrAtMost(2)` instead.
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
*
|
||||
* @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 one; use [exactly] instead.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>, S : InAnyOrderSearchBehaviour> IterableContains.Builder<E, T, S>.atMost(
|
||||
times: Int
|
||||
): AtMostCheckerOption<E, T, S> = AtMostCheckerOptionImpl(times, this)
|
||||
|
||||
/**
|
||||
* Restricts a `contains` assertion by specifying that the number of occurrences of the entry which we
|
||||
* are looking for occurs `not at all or at most` number of [times] within the [Iterable].
|
||||
*
|
||||
* @param times The number which the check will compare against the actual number of times an expected entry is
|
||||
* found in the [Iterable].
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>, S : InAnyOrderSearchBehaviour> IterableContains.Builder<E, T, S>.notOrAtMost(
|
||||
times: Int
|
||||
): NotOrAtMostCheckerOption<E, T, S> = NotOrAtMostCheckerOptionImpl(times, this)
|
||||
@@ -1,129 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Values
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Entries
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.builders.creating.basic.contains.addAssertion
|
||||
import ch.tutteli.atrium.domain.builders.utils.toVarArg
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains.CheckerOption
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderSearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.typeutils.IterableLike
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [expected]
|
||||
* value shall be searched within the [Iterable].
|
||||
*
|
||||
* Delegates to `the values(expected)`.
|
||||
*
|
||||
* @param expected The value which is expected to be contained within this [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> CheckerOption<E, T, InAnyOrderSearchBehaviour>.value(expected: E): Expect<T> =
|
||||
this the values(expected)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the expected [values]
|
||||
* shall be searched within the [Iterable].
|
||||
*
|
||||
* Notice, that it does not search for unique matches. Meaning, if the iterable is `setOf('a', 'b')` and
|
||||
* [Values] is defined as `values("a", "a")`, then both match,
|
||||
* even though they match the same sequence in the input of the search.
|
||||
* Use an option such as [atLeast], [atMost] and [exactly] to control the number of occurrences you expect.
|
||||
*
|
||||
* Meaning you might want to use:
|
||||
* `to contain inAny order exactly 2 value 'a'`
|
||||
* instead of:
|
||||
* `to contain inAny order exactly 1 the values('a', 'a')`
|
||||
*
|
||||
* @param values The values which are expected to be contained within the [Iterable]
|
||||
* -- use the function `values(t, ...)` to create a [Values].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> CheckerOption<E, T, InAnyOrderSearchBehaviour>.the(values: Values<E>): Expect<T> =
|
||||
addAssertion(ExpectImpl.iterable.contains.valuesInAnyOrder(this, values.toList()))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where an entry shall be searched which either
|
||||
* holds all assertions [assertionCreatorOrNull] creates or needs to be `null` in case [assertionCreatorOrNull]
|
||||
* is defined as `null`.
|
||||
*
|
||||
* Delegates to `the entries(assertionCreatorOrNull)`
|
||||
*
|
||||
* @param assertionCreatorOrNull The identification lambda which creates the assertions which the entry we are looking
|
||||
* for has to hold; or in other words, the function which defines whether an entry is the one we are looking for
|
||||
* or not. In case it is defined as `null`, then an entry is identified if it is `null` as well.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <E : Any, T : Iterable<E?>> CheckerOption<E?, T, InAnyOrderSearchBehaviour>.entry(
|
||||
assertionCreatorOrNull: (Expect<E>.() -> Unit)?
|
||||
): Expect<T> = this the entries(assertionCreatorOrNull)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where an entry shall be searched which either
|
||||
* holds all assertions [entries].[assertionCreatorOrNull][Entries.assertionCreatorOrNull] creates or
|
||||
* needs to be `null` in case [entries].[assertionCreatorOrNull][Entries.otherAssertionCreatorsOrNulls]
|
||||
* is defined as `null` -- likewise an entry (can be the same) is searched for each of
|
||||
* the [entries].[otherAssertionCreatorsOrNulls][Entries.otherAssertionCreatorsOrNulls].
|
||||
*
|
||||
* @param entries The entries which are expected to be contained within the [Iterable]
|
||||
* -- use the function `entries(t, ...)` to create an [Entries].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <E : Any, T : Iterable<E?>> CheckerOption<E?, T, InAnyOrderSearchBehaviour>.the(
|
||||
entries: Entries<E>
|
||||
): Expect<T> = addAssertion(ExpectImpl.iterable.contains.entriesInAnyOrder(this, entries.toList()))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterable]
|
||||
* shall be searched within the [Iterable].
|
||||
*
|
||||
* Delegates to [values] which also means that it does not search for unique matches
|
||||
* (see [values] for more information).
|
||||
*
|
||||
* @param expectedIterable The [Iterable] whose elements are expected to be contained within this [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case the given [expectedIterable] does not have elements (is empty).
|
||||
*
|
||||
* TODO remove with 1.0.0
|
||||
* @since 0.12.0
|
||||
*/
|
||||
inline infix fun <reified E, T : Iterable<E>> CheckerOption<E, T, InAnyOrderSearchBehaviour>.elementsOf(
|
||||
expectedIterable: Iterable<E>
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<E>(expectedIterable)
|
||||
return this the values(first, *rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterableLike]
|
||||
* shall be searched within the [Iterable].
|
||||
*
|
||||
* Delegates to [values] which also means that it does not search for unique matches
|
||||
* (see [values] for more information).
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [Iterable], [Sequence] or one of the [Array] types
|
||||
* are passed. This function expects [IterableLike] (which is a typealias for [Any]) to avoid cluttering the API.
|
||||
*
|
||||
* @param expectedIterableLike The [IterableLike] whose elements are expected to be contained within this [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types
|
||||
* or the given [expectedIterableLike] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.13.0
|
||||
*/
|
||||
inline infix fun <reified E, T : Iterable<E>> CheckerOption<E, T, InAnyOrderSearchBehaviour>.elementsOf(
|
||||
expectedIterableLike: IterableLike
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<E>(expectedIterableLike)
|
||||
return this the values(first, *rest)
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Values
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Entries
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.builders.creating.basic.contains.addAssertion
|
||||
import ch.tutteli.atrium.domain.builders.utils.toVarArg
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains.Builder
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InAnyOrderOnlySearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.typeutils.IterableLike
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [Iterable] needs to contain only the
|
||||
* [expected] value.
|
||||
*
|
||||
* Delegates to `the values(expected)`.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> Builder<E, T, InAnyOrderOnlySearchBehaviour>.value(expected: E): Expect<T> =
|
||||
this the values(expected)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the expected [values]
|
||||
* must be contained in [Iterable] but it does not matter in which order.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param values The values which are expected to be contained within the [Iterable]
|
||||
* -- use the function `values(t, ...)` to create a [Values].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> Builder<E, T, InAnyOrderOnlySearchBehaviour>.the(values: Values<E>): Expect<T> =
|
||||
addAssertion(ExpectImpl.iterable.contains.valuesInAnyOrderOnly(this, values.toList()))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [Iterable] needs to contain only one
|
||||
* entry which holds all assertions created by the given [assertionCreatorOrNull] or is `null` in case
|
||||
* [assertionCreatorOrNull] is defined as `null`.
|
||||
*
|
||||
* Delegates to `the entries(assertionCreatorOrNull)`
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param assertionCreatorOrNull The identification lambda which creates the assertions which the entry we are looking
|
||||
* for has to hold; or in other words, the function which defines whether an entry is the one we are looking for
|
||||
* or not. In case it is defined as `null`, then an entry is identified if it is `null` as well.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <E : Any, T : Iterable<E?>> Builder<E?, T, InAnyOrderOnlySearchBehaviour>.entry(
|
||||
assertionCreatorOrNull: (Expect<E>.() -> Unit)?
|
||||
): Expect<T> = this the entries(assertionCreatorOrNull)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where an entry needs to be contained in the
|
||||
* [Iterable] which holds all assertions [entries].[assertionCreatorOrNull][Entries.assertionCreatorOrNull]
|
||||
* creates or it needs to be `null` in case
|
||||
* [entries].[assertionCreatorOrNull][Entries.assertionCreatorOrNull] is defined as `null` -- likewise an
|
||||
* entry for each [entries].[otherAssertionCreatorsOrNulls][Entries.otherAssertionCreatorsOrNulls] needs to
|
||||
* be contained in the [Iterable] where it does not matter in which order the entries appear but only as many entries
|
||||
* should be returned by the [Iterable] as assertion creators are defined.
|
||||
*
|
||||
* Notice, that a first-wins strategy applies which means your assertion creator lambdas -- which kind of serve as
|
||||
* identification lambdas -- should be ordered in such a way that the most specific identification lambda appears
|
||||
* first, not that a less specific lambda wins. For instance, given a `setOf(1, 2)` you should not search for
|
||||
* `entries({ isGreaterThan(0) }, { toBe(1) })` but for `entries({ toBe(1) }, { isGreaterThan(0) })`
|
||||
* otherwise `isGreaterThan(0)` matches `1` before `toBe(1)` would match it. As a consequence `toBe(1)` could
|
||||
* only match the entry which is left -- in this case `2` -- and of course this would fail.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param entries The entries which are expected to be contained within the [Iterable]
|
||||
* -- use the function `entries(t, ...)` to create an [Entries].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
|
||||
infix fun <E : Any, T : Iterable<E?>> Builder<E?, T, InAnyOrderOnlySearchBehaviour>.the(
|
||||
entries: Entries<E>
|
||||
): Expect<T> = addAssertion(ExpectImpl.iterable.contains.entriesInAnyOrderOnly(this, entries.toList()))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements in
|
||||
* [expectedIterable] need to be contained in [Iterable] where it does not matter in which order but only as
|
||||
* many entries should be returned by the [Iterable] as values defined.
|
||||
*
|
||||
* Delegates to [values].
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expectedIterable The [Iterable] whose elements are expected to be contained within this [Iterable]
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case the given [expectedIterable] does not have elements (is empty).
|
||||
*
|
||||
* TODO remove with 1.0.0
|
||||
* @since 0.12.0
|
||||
*/
|
||||
inline infix fun <reified E, T : Iterable<E>> Builder<E, T, InAnyOrderOnlySearchBehaviour>.elementsOf(
|
||||
expectedIterable: Iterable<E>
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<E>(expectedIterable)
|
||||
return this the values(first, *rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements in
|
||||
* [expectedIterableLike] need to be contained in [Iterable] where it does not matter in which order but only as
|
||||
* many entries should be returned by the [Iterable] as values defined.
|
||||
*
|
||||
* Delegates to [values].
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [Iterable], [Sequence] or one of the [Array] types
|
||||
* are passed. This function expects [IterableLike] (which is a typealias for [Any]) to avoid cluttering the API.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expectedIterableLike The [IterableLike] whose elements are expected to be contained within this [Iterable]
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types
|
||||
* or the given [expectedIterableLike] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.13.0
|
||||
*/
|
||||
inline infix fun <reified E, T : Iterable<E>> Builder<E, T, InAnyOrderOnlySearchBehaviour>.elementsOf(
|
||||
expectedIterableLike: IterableLike
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<E>(expectedIterableLike)
|
||||
return this the values(first, *rest)
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Values
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Entries
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.builders.creating.basic.contains.addAssertion
|
||||
import ch.tutteli.atrium.domain.builders.utils.toVarArg
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains.Builder
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InOrderOnlySearchBehaviour
|
||||
import ch.tutteli.atrium.domain.creating.typeutils.IterableLike
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [Iterable] needs to contain only the
|
||||
* [expected] value.
|
||||
*
|
||||
* Delegates to `the values(expected)`.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expected The value which is expected to be contained within the [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> Builder<E, T, InOrderOnlySearchBehaviour>.value(expected: E): Expect<T> =
|
||||
this the values(expected)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [Iterable] needs to contain only the
|
||||
* expected [values] in the specified order.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param values The values which are expected to be contained within the [Iterable]
|
||||
* -- use the function `values(t, ...)` to create a [Values].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> Builder<E, T, InOrderOnlySearchBehaviour>.the(values: Values<E>): Expect<T> =
|
||||
addAssertion(ExpectImpl.iterable.contains.valuesInOrderOnly(this, values.toList()))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [Iterable] needs to contain only a
|
||||
* single entry which holds all assertions created by the given [assertionCreatorOrNull] or needs to be `null`
|
||||
* in case [assertionCreatorOrNull] is defined as `null`.
|
||||
*
|
||||
* Delegates to `the entries(assertionCreatorOrNull)`.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param assertionCreatorOrNull The identification lambda which creates the assertions which the entry we are looking
|
||||
* for has to hold; or in other words, the function which defines whether an entry is the one we are looking for
|
||||
* or not. In case it is defined as `null`, then an entry is identified if it is `null` as well.
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <E : Any, T : Iterable<E?>> Builder<E?, T, InOrderOnlySearchBehaviour>.entry(
|
||||
assertionCreatorOrNull: (Expect<E>.() -> Unit)?
|
||||
): Expect<T> = this the entries(assertionCreatorOrNull)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the [Iterable] needs to contain only an
|
||||
* entry which holds all assertions [entries].[assertionCreatorOrNull][Entries.assertionCreatorOrNull]
|
||||
* creates or is `null` in case [entries].[assertionCreatorOrNull][Entries.otherAssertionCreatorsOrNulls]
|
||||
* is defined as `null` and likewise a further entry for each
|
||||
* [entries].[otherAssertionCreatorsOrNulls][Entries.otherAssertionCreatorsOrNulls]
|
||||
* (if given) whereas the entries have to appear in the specified order.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param entries The entries which are expected to be contained within the [Iterable]
|
||||
* -- use the function `entries(t, ...)` to create an [Entries].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <E : Any, T : Iterable<E?>> Builder<E?, T, InOrderOnlySearchBehaviour>.the(
|
||||
entries: Entries<E>
|
||||
): Expect<T> = addAssertion(ExpectImpl.iterable.contains.entriesInOrderOnly(this, entries.toList()))
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterable]
|
||||
* shall be searched within the [Iterable]
|
||||
* (if given) in the specified order.
|
||||
*
|
||||
* Delegates to [values].
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expectedIterable The [Iterable] whose elements are expected to be contained within this [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case the given [expectedIterable] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.12.0
|
||||
* TODO remove with 1.0.0
|
||||
*/
|
||||
inline infix fun <reified E, T : Iterable<E>> Builder<E, T, InOrderOnlySearchBehaviour>.elementsOf(
|
||||
expectedIterable: Iterable<E>
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<E>(expectedIterable)
|
||||
return this the values(first, *rest)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where all elements of the [expectedIterableLike]
|
||||
* shall be searched within the [Iterable]
|
||||
* (if given) in the specified order.
|
||||
*
|
||||
* Delegates to [values].
|
||||
*
|
||||
* Notice that a runtime check applies which assures that only [Iterable], [Sequence] or one of the [Array] types
|
||||
* are passed. This function expects [IterableLike] (which is a typealias for [Any]) to avoid cluttering the API.
|
||||
*
|
||||
* Note that we might change the signature of this function with the next version
|
||||
* which will cause a binary backward compatibility break (see
|
||||
* [#292](https://github.com/robstoll/atrium/issues/292) for more information)
|
||||
*
|
||||
* @param expectedIterableLike The [IterableLike] whose elements are expected to be contained within this [Iterable].
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
* @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types
|
||||
* or the given [expectedIterableLike] does not have elements (is empty).
|
||||
*
|
||||
* @since 0.13.0
|
||||
*/
|
||||
inline infix fun <reified E, T : Iterable<E>> Builder<E, T, InOrderOnlySearchBehaviour>.elementsOf(
|
||||
expectedIterableLike: IterableLike
|
||||
): Expect<T> {
|
||||
val (first, rest) = toVarArg<E>(expectedIterableLike)
|
||||
return this the values(first, *rest)
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.Order
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.builders.creating.basic.contains.addAssertion
|
||||
import ch.tutteli.atrium.domain.builders.utils.Group
|
||||
import ch.tutteli.atrium.domain.builders.utils.groupsToList
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains.Builder
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.InOrderOnlyGroupedWithinSearchBehaviour
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the expected [Order.firstGroup] as well as
|
||||
* the [Order.secondGroup] and optionally [Order.otherExpectedGroups] of values need to be
|
||||
* contained in [Iterable] in the specified order whereas the values within the groups can occur in any order.
|
||||
*
|
||||
* @param order A parameter object containing the different groups which have to appear in order in the [Iterable]
|
||||
* -- use `order(group, group, ...)` to create an [Order] where group is either `value(e)` or `values(e, ...)`;
|
||||
* so a call could look as follows: `inAny order(values(1, 2), value(2), values(3, 2))
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> Builder<E, T, InOrderOnlyGroupedWithinSearchBehaviour>.inAny(
|
||||
order: Order<E, Group<E>>
|
||||
): Expect<T> = addAssertion(
|
||||
ExpectImpl.iterable.contains.valuesInOrderOnlyGrouped(
|
||||
this,
|
||||
groupsToList(order.firstGroup, order.secondGroup, order.otherExpectedGroups)
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* Helper function to create an [Order] based on the given [firstGroup], [secondGroup] and [otherExpectedGroups].
|
||||
*/
|
||||
//TODO move to iterableLikeContainsInOrderOnlyGroupedCreators with 1.0.0 - here to retain bbc
|
||||
fun <E> order(
|
||||
firstGroup: Group<E>,
|
||||
secondGroup: Group<E>,
|
||||
vararg otherExpectedGroups: Group<E>
|
||||
): Order<E, Group<E>> = Order(firstGroup, secondGroup, otherExpectedGroups)
|
||||
|
||||
/**
|
||||
* Finishes the specification of the sophisticated `contains` assertion where the expected [Order.firstGroup] as well as
|
||||
* the [Order.secondGroup] and optionally [Order.otherExpectedGroups] of identification lambdas, identifying an entry,
|
||||
* need to be contained in [Iterable] in the specified order whereas the identification lambdas within the groups
|
||||
* can occur in any order.
|
||||
*
|
||||
* An identification lambda can also be defined as `null` in which case it matches an entry which is `null` as well.
|
||||
*
|
||||
* @param order A parameter object containing the different groups which have to appear in order in the [Iterable]
|
||||
* -- use `order(group, group, ...)` to create an [Order] where group is either `entry { ... }` or
|
||||
* `entries({ ... }, ...)`; so a call could look as follows:
|
||||
* ```
|
||||
* inAny order(
|
||||
* entry { it toBe 1 },
|
||||
* entries({ it lessThan 2 }, {it toBe 3 })
|
||||
* )
|
||||
* ```
|
||||
*
|
||||
* @return An [Expect] for the current subject of the assertion.
|
||||
*/
|
||||
@JvmName("inAnyOrderEntries")
|
||||
infix fun <E : Any, T : Iterable<E?>> Builder<E?, T, InOrderOnlyGroupedWithinSearchBehaviour>.inAny(
|
||||
order: Order<(Expect<E>.() -> Unit)?, Group<(Expect<E>.() -> Unit)?>>
|
||||
): Expect<T> = addAssertion(
|
||||
ExpectImpl.iterable.contains.entriesInOrderOnlyGrouped(
|
||||
this,
|
||||
groupsToList(order.firstGroup, order.secondGroup, order.otherExpectedGroups)
|
||||
)
|
||||
)
|
||||
@@ -1,71 +0,0 @@
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.IterableContains.Builder
|
||||
import ch.tutteli.atrium.domain.creating.iterable.contains.searchbehaviours.*
|
||||
|
||||
/**
|
||||
* Defines that the search behaviour "find entries `in any order` in the [Iterable]" shall be applied to this
|
||||
* sophisticated `contains` in [Iterable] assertion.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> Builder<E, T, NoOpSearchBehaviour>.inAny(
|
||||
@Suppress("UNUSED_PARAMETER") order: order
|
||||
): Builder<E, T, InAnyOrderSearchBehaviour> = ExpectImpl.iterable.contains.searchBehaviours.inAnyOrder(this)
|
||||
|
||||
/**
|
||||
* Defines that the constraint "`only` the specified entries exist in the [Iterable]" shall be applied to this
|
||||
* sophisticated `contains` [Iterable] assertion.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> Builder<E, T, InAnyOrderSearchBehaviour>.but(
|
||||
@Suppress("UNUSED_PARAMETER") only: only
|
||||
): Builder<E, T, InAnyOrderOnlySearchBehaviour> = ExpectImpl.iterable.contains.searchBehaviours.inAnyOrderOnly(this)
|
||||
|
||||
|
||||
/**
|
||||
* Defines that the search behaviour "find entries `in order` in the [Iterable]" shall be applied to this
|
||||
* sophisticated `contains` in [Iterable] assertion.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> Builder<E, T, NoOpSearchBehaviour>.inGiven(
|
||||
@Suppress("UNUSED_PARAMETER") order: order
|
||||
): Builder<E, T, InOrderSearchBehaviour> = ExpectImpl.iterable.contains.searchBehaviours.inOrder(this)
|
||||
|
||||
/**
|
||||
* Defines that the constraint "`only` the specified entries exist in the [Iterable]" shall be applied to this
|
||||
* sophisticated `contains in order` [Iterable] assertion.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> Builder<E, T, InOrderSearchBehaviour>.and(
|
||||
@Suppress("UNUSED_PARAMETER") only: only
|
||||
): Builder<E, T, InOrderOnlySearchBehaviour> = ExpectImpl.iterable.contains.searchBehaviours.inOrderOnly(this)
|
||||
|
||||
/**
|
||||
* Defines that the [Iterable] contains `in order only` groups of entries
|
||||
* whereas the order within the group is specified as next step.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> Builder<E, T, InOrderOnlySearchBehaviour>.grouped(
|
||||
@Suppress("UNUSED_PARAMETER") entries: entries
|
||||
): Builder<E, T, InOrderOnlyGroupedSearchBehaviour> =
|
||||
ExpectImpl.iterable.contains.searchBehaviours.inOrderOnlyGrouped(this)
|
||||
|
||||
/**
|
||||
* A filler word to emphasis that the next step defines the order within expected groups of values.
|
||||
*
|
||||
* @return The newly created builder.
|
||||
*/
|
||||
infix fun <E, T : Iterable<E>> Builder<E, T, InOrderOnlyGroupedSearchBehaviour>.within(
|
||||
@Suppress("UNUSED_PARAMETER") group: group
|
||||
): Builder<E, T, InOrderOnlyGroupedWithinSearchBehaviour> =
|
||||
ExpectImpl.iterable.contains.searchBehaviours.inOrderOnlyGroupedWithin(this)
|
||||
|
||||
@@ -54,3 +54,12 @@ infix fun <E, T : IterableLike> EntryPointStep<E, T, InOrderOnlyGroupedWithinSea
|
||||
infix fun <E : Any, T : IterableLike> EntryPointStep<out E?, T, InOrderOnlyGroupedWithinSearchBehaviour>.inAny(
|
||||
order: Order<(Expect<E>.() -> Unit)?, Group<(Expect<E>.() -> Unit)?>>
|
||||
): Expect<T> = _logicAppend { entriesInOrderOnlyGrouped(order.toList()) }
|
||||
|
||||
/**
|
||||
* Helper function to create an [Order] based on the given [firstGroup], [secondGroup] and [otherExpectedGroups].
|
||||
*/
|
||||
fun <E> order(
|
||||
firstGroup: Group<E>,
|
||||
secondGroup: Group<E>,
|
||||
vararg otherExpectedGroups: Group<E>
|
||||
): Order<E, Group<E>> = Order(firstGroup, secondGroup, otherExpectedGroups)
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import org.spekframework.spek2.Spek
|
||||
import org.spekframework.spek2.style.specification.describe
|
||||
|
||||
class CharSequenceContainsRegexAssertionsSpec : Spek({
|
||||
include(StringSpec)
|
||||
include(RegexSpec)
|
||||
|
||||
|
||||
describe("context 'aaaa'") {
|
||||
it("search for 'aa' finds 3 hits since we want non disjoint matches") {
|
||||
expect("aaaa") contains o exactly 3 regex "aa"
|
||||
}
|
||||
it("search for 'aa?' finds 4 hits since we want non disjoint matches") {
|
||||
expect("aaaa")contains o exactly 4 regex "aa?"
|
||||
}
|
||||
}
|
||||
}) {
|
||||
object StringSpec : ch.tutteli.atrium.specs.integration.CharSequenceContainsRegexAssertionsSpec(
|
||||
getNameContainsRegex(),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.logic._logic
|
||||
import ch.tutteli.atrium.logic.changeSubject
|
||||
import ch.tutteli.atrium.specs.fun1
|
||||
|
||||
@@ -19,7 +19,7 @@ dependencies {
|
||||
}
|
||||
|
||||
|
||||
//TODO should not be necessary https://youtrack.jetbrains.com/issue/KT-28124
|
||||
//TODO 0.16.0 or 0.17.0 should not be necessary https://youtrack.jetbrains.com/issue/KT-28124
|
||||
compileTestKotlin.dependsOn(
|
||||
prefixedProject('core-robstoll-jvm').compileKotlin,
|
||||
prefixedProject('core-robstoll-jvm').processResources,
|
||||
|
||||
@@ -6,10 +6,8 @@ module ch.tutteli.atrium.api.infix.en_GB {
|
||||
|
||||
exports ch.tutteli.atrium.api.infix.en_GB;
|
||||
exports ch.tutteli.atrium.api.infix.en_GB.creating;
|
||||
exports ch.tutteli.atrium.api.infix.en_GB.creating.charsequence.contains.builders;
|
||||
exports ch.tutteli.atrium.api.infix.en_GB.creating.feature;
|
||||
exports ch.tutteli.atrium.api.infix.en_GB.creating.iterable;
|
||||
exports ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.builders;
|
||||
exports ch.tutteli.atrium.api.infix.en_GB.creating.map;
|
||||
exports ch.tutteli.atrium.api.infix.en_GB.creating.path;
|
||||
exports ch.tutteli.atrium.api.infix.en_GB.workaround;
|
||||
|
||||
@@ -16,7 +16,7 @@ dependencies {
|
||||
}
|
||||
|
||||
|
||||
//TODO should not be necessary https://youtrack.jetbrains.com/issue/KT-28124
|
||||
//TODO 0.16.0 or 0.17.0 should not be necessary https://youtrack.jetbrains.com/issue/KT-28124
|
||||
compileTestKotlin.dependsOn(
|
||||
prefixedProject('core-robstoll-jvm').compileKotlin,
|
||||
prefixedProject('core-robstoll-jvm').processResources,
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
package ch.tutteli.atrium.scala2.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.creating.AnyAssertionsBuilder
|
||||
import ch.tutteli.atrium.logic.impl.DefaultAnyAssertions
|
||||
import ch.tutteli.atrium.creating.AssertionContainer
|
||||
import ch.tutteli.atrium.logic.LogicKt
|
||||
import ch.tutteli.atrium.logic.AnyKt
|
||||
import ch.tutteli.atrium.logic.{AnyKt, LogicKt}
|
||||
|
||||
class AnyAssertions[T](expect: Expect[T]) {
|
||||
class AnyExpectations[T](override val expect: Expect[T]) extends BaseExpectations[T] {
|
||||
|
||||
def toBe(expected: T): Expect[T] =
|
||||
addAssertion(c => AnyKt.toBe(c, expected))
|
||||
@@ -22,8 +17,8 @@ class AnyAssertions[T](expect: Expect[T]) {
|
||||
def isNotSameAs(expected: T): Expect[T] =
|
||||
addAssertion(c => AnyKt.isNotSameAs(c, expected))
|
||||
|
||||
def toBeNullIfNullGivenElse(assertionCreatorOrNull: Expect[T] => Unit)(implicit kClass: KClassTag[T]): Expect[T] =
|
||||
addAssertion(c => AnyKt.toBeNullIfNullGivenElse(c, kClass.kClass, assertionCreatorOrNull))
|
||||
def toBeNullIfNullGivenElse(assertionCreatorOrNull: Expect[T] => Unit): Expect[T] =
|
||||
addAssertion(c => AnyKt.toBeNullIfNullGivenElse(c, assertionCreatorOrNull))
|
||||
|
||||
def notToBeNull()(implicit kClass: KClassTag[T]): Expect[T] = isA[T]()
|
||||
|
||||
@@ -50,7 +45,4 @@ class AnyAssertions[T](expect: Expect[T]) {
|
||||
|
||||
def because(reason: String, assertionCreator: Expect[T] => Unit): Expect[T] =
|
||||
addAssertion(c => AnyKt.because(c, reason, assertionCreator))
|
||||
|
||||
@inline private def addAssertion(f: AssertionContainer[T] => Assertion): Expect[T] =
|
||||
LogicKt._logicAppend(expect, f)
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package ch.tutteli.atrium.scala2.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.creating.changers.PostFinalStep
|
||||
trait BaseAssertions {
|
||||
implicit class RxPostFinalStep[T, R, E <: Expect[R]](postStep: PostFinalStep[T, R, E]) {
|
||||
@inline def expectOfFeature: E = postStep.getExpectOfFeature
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package ch.tutteli.atrium.scala2.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.creating.{AssertionContainer, Expect}
|
||||
import ch.tutteli.atrium.logic.LogicKt
|
||||
|
||||
trait BaseExpectations[T] {
|
||||
protected val expect: Expect[T]
|
||||
|
||||
@inline protected def addAssertion(f: AssertionContainer[T] => Assertion): Expect[T] =
|
||||
LogicKt._logicAppend(expect, f)
|
||||
}
|
||||
@@ -2,32 +2,11 @@ package ch.tutteli.atrium.scala2.api.fluent.en_GB
|
||||
|
||||
import scala.collection.generic.IsIterable
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import java.lang.{Iterable => JIterable}
|
||||
|
||||
import java.lang.{Iterable => JIterable}
|
||||
import scala.jdk.CollectionConverters._
|
||||
import ch.tutteli.atrium.logic.{LogicKt, UtilsKt}
|
||||
|
||||
object IsIterableHelpers {
|
||||
type IsIterableFixA[Repr, A0] = IsIterable[Repr] { type A = A0 }
|
||||
|
||||
implicit class RxExpectIsIterable[Repr](expect: Expect[Repr]) {
|
||||
|
||||
def asExpectJIterable[E](implicit isIterable: IsIterableFixA[Repr, E]): Expect[JIterable[E]] =
|
||||
ExpectImpl.changeSubject(expect).unreported { iterableLikeSubject =>
|
||||
val subject = isIterable.apply(iterableLikeSubject)
|
||||
subject match {
|
||||
case l: List[E] => l.asJava
|
||||
case l: Iterable[E] => l.asJava
|
||||
case subject => subject.toList.asJava
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
implicit class RxExpectJ[E](expectJ: Expect[JIterable[E]]) {
|
||||
|
||||
def backToScalaRepr[Repr](originalExpect: Expect[Repr]): Expect[Repr] =
|
||||
originalExpect.getMaybeSubject.fold(
|
||||
() => expectJ.asInstanceOf[Expect[Repr]],
|
||||
subject => ExpectImpl.changeSubject(expectJ).unreported(_ => subject)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package ch.tutteli.atrium.scala2.api.fluent.en_GB
|
||||
|
||||
import java.lang.{Iterable => JIterable}
|
||||
|
||||
import IsIterableHelpers._
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.creating.IterableAssertionsBuilder
|
||||
|
||||
class IterableLikeElementComparableAssertions[Repr, E <: Comparable[E]](expect: Expect[Repr])(
|
||||
implicit isIterable: IsIterableFixA[Repr, E]
|
||||
) extends BaseAssertions {
|
||||
private val expectJ: Expect[JIterable[E]] = expect.asExpectJIterable
|
||||
|
||||
@inline private def iterableAssertions: IterableAssertionsBuilder = ExpectImpl.getIterable
|
||||
|
||||
def min(): Expect[E] = iterableAssertions.min[E, JIterable[E]](expectJ).expectOfFeature
|
||||
def max(): Expect[E] = iterableAssertions.max[E, JIterable[E]](expectJ).expectOfFeature
|
||||
|
||||
def min(assertionCreator: Expect[E] => Unit): Expect[Repr] =
|
||||
iterableAssertions.min[E, JIterable[E]](expectJ).addToInitial(assertionCreator).backToScalaRepr(expect)
|
||||
|
||||
def max(assertionCreator: Expect[E] => Unit): Expect[Repr] =
|
||||
iterableAssertions.max[E, JIterable[E]](expectJ).addToInitial(assertionCreator).backToScalaRepr(expect)
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package ch.tutteli.atrium.scala2.api.fluent.en_GB
|
||||
|
||||
import java.lang.{Iterable => JIterable}
|
||||
import IsIterableHelpers._
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.logic.{IterableLikeKt, LogicKt}
|
||||
|
||||
class IterableLikeElementComparableExpectations[Repr, E <: Comparable[E]](override val expect: Expect[Repr])(
|
||||
implicit isIterable: IsIterableFixA[Repr, E]
|
||||
) extends BaseExpectations[Repr] {
|
||||
import scala.jdk.CollectionConverters._
|
||||
|
||||
private def convertToJIterable(repr: Repr): JIterable[E] = {
|
||||
val subject = isIterable.apply(repr)
|
||||
subject match {
|
||||
case l: List[E] => l.asJava
|
||||
case i: Iterable[E] => i.asJava
|
||||
case subject => subject.toList.asJava
|
||||
}
|
||||
}
|
||||
|
||||
def min(): Expect[E] =
|
||||
IterableLikeKt.min(LogicKt.get_logic(expect), convertToJIterable).transform()
|
||||
|
||||
def max(): Expect[E] =
|
||||
IterableLikeKt.max(LogicKt.get_logic(expect), convertToJIterable).transform()
|
||||
|
||||
def min(assertionCreator: Expect[E] => Unit): Expect[Repr] =
|
||||
IterableLikeKt.min(LogicKt.get_logic(expect), convertToJIterable).collectAndAppend(assertionCreator)
|
||||
|
||||
def max(assertionCreator: Expect[E] => Unit): Expect[Repr] =
|
||||
IterableLikeKt.max(LogicKt.get_logic(expect), convertToJIterable).collectAndAppend(assertionCreator)
|
||||
}
|
||||
@@ -1,22 +1,18 @@
|
||||
package ch.tutteli.atrium.scala2.api.fluent
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import _root_.scala.annotation.unchecked.uncheckedVariance
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
package object en_GB extends ScalaKotlinConversions {
|
||||
import IsIterableHelpers._
|
||||
|
||||
@inline val ExpectImpl: ExpectImpl =
|
||||
ch.tutteli.atrium.domain.builders.ExpectImpl.INSTANCE
|
||||
|
||||
implicit def expectToAnyAssertions[T](expect: Expect[T]): AnyAssertions[T] =
|
||||
new AnyAssertions(expect)
|
||||
implicit def expectToAnyAssertions[T](expect: Expect[T]): AnyExpectations[T] =
|
||||
new AnyExpectations(expect)
|
||||
|
||||
implicit def expectToIterableLikeElementComparableAssertions[Repr, E <: Comparable[E]](expect: Expect[Repr])(
|
||||
implicit it: IsIterableFixA[Repr, E]
|
||||
): IterableLikeElementComparableAssertions[Repr, E] = new IterableLikeElementComparableAssertions(expect)
|
||||
): IterableLikeElementComparableExpectations[Repr, E] = new IterableLikeElementComparableExpectations(expect)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package ch.tutteli.atrium.scala2.api.fluent.en_GB
|
||||
import TestUtils._
|
||||
import AnyAssertionsSpec._
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.api.verbs.internal.AtriumVerbsKt.expect
|
||||
|
||||
class AnyAssertionsSpec
|
||||
extends ch.tutteli.atrium.specs.integration.AnyAssertionsSpec(
|
||||
@@ -63,4 +64,9 @@ object AnyAssertionsSpec {
|
||||
implicit class RxKotlinPair[T](pair: kotlin.Pair[String, T]) {
|
||||
def withNullableSuffix() = new kotlin.Pair(pair.getFirst+" (nullable)", pair.getSecond)
|
||||
}
|
||||
|
||||
def ambiguityTest() = {
|
||||
expect(1).toBe(1)
|
||||
expect(1).notToBe(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import ch.tutteli.atrium.creating.Expect
|
||||
import java.lang.{Iterable => JIterable}
|
||||
|
||||
import scala.reflect.ClassTag
|
||||
import IterableFeatureAssertionsSpec._
|
||||
import IsIterableHelpers._
|
||||
|
||||
// FIXME rewrite after fusing IterableFutureAssertionsSpec with IterableAssertionsSpecr
|
||||
@@ -26,17 +25,3 @@ import IsIterableHelpers._
|
||||
// fun1("max", changeToScalaArray(_).max(_).asExpectJIterable),
|
||||
// "[Atrium] "
|
||||
// )
|
||||
|
||||
//noinspection TypeAnnotation
|
||||
object IterableFeatureAssertionsSpec {
|
||||
|
||||
def changeToScalaIterable[E](expect: Expect[JIterable[E]]) = {
|
||||
import scala.jdk.CollectionConverters._
|
||||
ExpectImpl.changeSubject(expect).unreported(s => s.asScala)
|
||||
}
|
||||
|
||||
def changeToScalaArray[E: ClassTag](expect: Expect[JIterable[E]]) = {
|
||||
import scala.jdk.CollectionConverters._
|
||||
ExpectImpl.changeSubject(expect).unreported(s => s.asScala.toArray)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
buildscript {
|
||||
rootProject.version = '0.15.0-SNAPSHOT'
|
||||
rootProject.version = '0.16.0-SNAPSHOT'
|
||||
rootProject.group = 'ch.tutteli.atrium'
|
||||
ext {
|
||||
atriumKotlinDep = { name -> "ch.tutteli.atrium:atrium-$name:$rootProject.version" }
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user