mirror of
https://github.com/jlengrand/atrium.git
synced 2026-03-10 08:01:19 +00:00
remove deprecated APIs, bundles, domain/core and part of domain-builders
moreover:
- remove deprecated translation modules
- remove functions in api-fluent and api-infix which were only there
due to bbc, we are going to break binary compatibility anyway, so we
can remove them.
- remove Assert/AssertionPlant and co.
- remove AssertionChecker and co.
- remove deprecated verbs using still Assert
- remove ExpectImpl and co.
- remove AssertImpl and co.
- remove subject from SubjectProvider (was only there because of Assert)
- also remove PlantHasNoSubjectException and simplify corresponding
code catching it.
- remove all deprecated functionality in domain-api, domain-builders
domain-robstoll and domain-robstoll-lib which were only used by the
deprecated APIs
- remove atrium-spec, was only used by deprecated APIs
- remove spek1 dependencies, all projects are now using spek2
- move spec about disjunctive matches from domain-builders into the
corresponding APIs
This commit is contained in:
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,
|
||||
|
||||
62
build.gradle
62
build.gradle
@@ -17,7 +17,6 @@ buildscript {
|
||||
jacoco_tool_version = '0.8.6'
|
||||
junit_platform_version = '1.7.0'
|
||||
jupiter_version = '5.7.0'
|
||||
spek_version = '1.1.5'
|
||||
spek2_version = '2.0.12'
|
||||
spekExtensions_version = '1.1.0'
|
||||
spekExtensions = { "ch.tutteli.spek:tutteli-spek-extensions:$spekExtensions_version" }
|
||||
@@ -64,10 +63,9 @@ buildscript {
|
||||
toolProjects = toolProjectsFun
|
||||
|
||||
// jacoco-multi-project.gradle
|
||||
def deprecatedProjects = subprojects.findAll { it.name.endsWith("-deprecated") }
|
||||
jacocoMulti = [
|
||||
sourceProjects:
|
||||
(subprojects - deprecatedProjects - toolProjectsFun).findAll {
|
||||
(subprojects - toolProjectsFun).findAll {
|
||||
!it.name.endsWith("-js") &&
|
||||
!it.name.endsWith("-android") &&
|
||||
// would have two classes with the same name if we add it as project as well,
|
||||
@@ -78,33 +76,20 @@ buildscript {
|
||||
!it.name.startsWith("${rootProject.name}-specs")
|
||||
},
|
||||
jacocoProjects:
|
||||
(subprojects - deprecatedProjects - toolProjectsFun).findAll {
|
||||
(subprojects - toolProjectsFun).findAll {
|
||||
!(it.projectDir.path.contains("/translations/") || it.projectDir.path.contains("\\translations\\")) &&
|
||||
!it.name.endsWith("-common") &&
|
||||
!it.name.endsWith("-js") &&
|
||||
!it.name.endsWith("-android") &&
|
||||
it.name != "${rootProject.name}-domain-api-jvm" &&
|
||||
it.name != "${rootProject.name}-domain-robstoll-jvm" &&
|
||||
it.name != "${rootProject.name}-core-robstoll-jvm" &&
|
||||
it.name != "${rootProject.name}-spec" &&
|
||||
!it.name.startsWith("${rootProject.name}-specs") &&
|
||||
//TODO remove with 1.0.0
|
||||
it.name != "${rootProject.name}-assertions" &&
|
||||
it.name != "${rootProject.name}-core-api-deprecated" &&
|
||||
it.name != "${rootProject.name}-core-robstoll-deprecated" &&
|
||||
it.name != "${rootProject.name}-domain-api-deprecated"
|
||||
//TODO remove with 0.17.0
|
||||
it.name != "${rootProject.name}-domain-robstoll-jvm" &&
|
||||
it.name != "${rootProject.name}-domain-builders-jvm"
|
||||
}
|
||||
]
|
||||
|
||||
//TODO dependencies no longer required once all specs are with spek2 where they are set via spek plugin
|
||||
spekDep = { closure ->
|
||||
delegate = closure
|
||||
testRuntimeOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
testRuntimeOnly "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
testImplementation "org.spekframework.spek2:spek-dsl-jvm:$spek2_version", excludeKotlin
|
||||
testRuntimeOnly "org.spekframework.spek2:spek-runner-junit5:$spek2_version", excludeKotlin
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -273,7 +258,7 @@ configure(subprojects - bundleSmokeTests - toolProjects) { subproject ->
|
||||
|
||||
configure(jacocoMulti.jacocoProjects + getAndroidProjects()) {
|
||||
apply plugin: 'ch.tutteli.spek'
|
||||
spek.version = '1.1.5'
|
||||
spek.version = spek2_version
|
||||
|
||||
dependencies {
|
||||
testImplementation mockito(), excludeKotlin
|
||||
@@ -298,18 +283,6 @@ configure(jacocoMulti.jacocoProjects + getAndroidProjects()) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
//TODO remove once all specs are migrated to spek2
|
||||
options {
|
||||
if (project.name != 'atrium-spec') {
|
||||
includeEngines 'spek2'
|
||||
}
|
||||
if (!project.name.startsWith('atrium-specs')) {
|
||||
includeEngines 'spek'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configure(subprojects - toolProjects) {
|
||||
@@ -350,13 +323,6 @@ configure(bundleSmokeTests) {
|
||||
dependencies {
|
||||
//I don't see how to set up compileTestKotlin with --patch-module, so we have put the module-info.java directly in src/test/kotlin instead
|
||||
testImplementation bundle
|
||||
//TODO remove once all specs are with spek2 where they are set via spek plugin
|
||||
spekDep(delegate)
|
||||
}
|
||||
} else {
|
||||
//TODO remove once all specs are with spek2 where they are set via spek plugin
|
||||
dependencies {
|
||||
spekDep(delegate)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -409,7 +375,10 @@ def createRegisterJsServicesTask(String projectName, String packageName, Functio
|
||||
}
|
||||
|
||||
createRegisterJsServicesTask('core-robstoll-js', 'ch.tutteli.atrium.core.robstoll') { true }
|
||||
createRegisterJsServicesTask('domain-robstoll-kotlin_1_3-js', 'ch.tutteli.atrium.domain.kotlin_1_3') { true }
|
||||
|
||||
createRegisterJsServicesTask('verbs-internal-js', 'ch.tutteli.atrium.verbs.internal') { true }
|
||||
//TODO remove with 0.17.0
|
||||
createRegisterJsServicesTask('domain-builders-js', 'ch.tutteli.atrium.domain.builders') { true }
|
||||
createRegisterJsServicesTask('domain-robstoll-js', 'ch.tutteli.atrium.domain.robstoll') {
|
||||
!(it in [
|
||||
'ch.tutteli.atrium.domain.creating.BigDecimalAssertions',
|
||||
@@ -423,8 +392,6 @@ createRegisterJsServicesTask('domain-robstoll-js', 'ch.tutteli.atrium.domain.rob
|
||||
'ch.tutteli.atrium.domain.creating.ChronoZonedDateTimeAssertions'
|
||||
])
|
||||
}
|
||||
createRegisterJsServicesTask('domain-builders-js', 'ch.tutteli.atrium.domain.builders') { true }
|
||||
createRegisterJsServicesTask('verbs-internal-js', 'ch.tutteli.atrium.verbs.internal') { true }
|
||||
|
||||
List<Project> projectNamesToProject(String[] names) {
|
||||
names.collect { projectName -> prefixedProject(projectName) }
|
||||
@@ -479,11 +446,7 @@ createJsTestTask(
|
||||
'core-robstoll-lib-js',
|
||||
'api-fluent-en_GB-js',
|
||||
'api-infix-en_GB-js',
|
||||
'fluent-en_GB-js',
|
||||
//TODO remove with 1.0.0
|
||||
'cc-de_CH-robstoll-js',
|
||||
'cc-en_GB-robstoll-js',
|
||||
'cc-infix-en_GB-robstoll-js',
|
||||
'fluent-en_GB-js'
|
||||
)
|
||||
|
||||
def useJupiter(String... projectNames) {
|
||||
@@ -503,9 +466,6 @@ useJupiter(
|
||||
'core-api-jvm',
|
||||
'api-fluent-en_GB-jvm',
|
||||
'api-infix-en_GB-jvm',
|
||||
'cc-de_CH-robstoll-jvm',
|
||||
'cc-en_GB-robstoll-jvm',
|
||||
'cc-infix-en_GB-robstoll-jvm',
|
||||
)
|
||||
|
||||
def buildNonDeprecatedJvm = task('buildNonDeprecatedJvm', group: 'build', description: 'builds all JVM modules')
|
||||
|
||||
@@ -10,7 +10,4 @@ dependencies {
|
||||
|
||||
runtimeOnly prefixedProject('domain-robstoll-jvm')
|
||||
runtimeOnly prefixedProject('core-robstoll-jvm')
|
||||
|
||||
//TODO remove once all specs are with spek2 where they are set via spek plugin
|
||||
spekDep(delegate)
|
||||
}
|
||||
|
||||
@@ -31,9 +31,8 @@ object SmokeSpec : Spek({
|
||||
}
|
||||
})
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
fun Expect<Int>.isEven() =
|
||||
createAndAddAssertion(DescriptionBasic.IS, Text("an even number")) { subject % 2 == 0 }
|
||||
createAndAddAssertion(DescriptionBasic.IS, Text("an even number")) { it % 2 == 0 }
|
||||
|
||||
fun Expect<Int>.isMultipleOf(base: Int) = addAssertion(_isMultipleOf(this, base))
|
||||
|
||||
|
||||
@@ -7,5 +7,4 @@ dependencies {
|
||||
//I don't see how to set up compileTestKotlin with --patch-module, so we have put the module-info.java directly in src/test/kotlin instead
|
||||
testImplementation prefixedProject('fluent-en_GB-jvm')
|
||||
testImplementation prefixedProject('api-fluent-en_GB-kotlin_1_3-jvm')
|
||||
testRuntimeOnly prefixedProject('domain-robstoll-kotlin_1_3-jvm')
|
||||
}
|
||||
|
||||
@@ -10,7 +10,4 @@ dependencies {
|
||||
|
||||
runtimeOnly prefixedProject('domain-robstoll-jvm')
|
||||
runtimeOnly prefixedProject('core-robstoll-jvm')
|
||||
|
||||
//TODO remove once all specs are with spek2 where they are set via spek plugin
|
||||
spekDep(delegate)
|
||||
}
|
||||
|
||||
@@ -7,5 +7,4 @@ dependencies {
|
||||
//I don't see how to set up compileTestKotlin with --patch-module, so we have put the module-info.java directly in src/test/kotlin instead
|
||||
testImplementation prefixedProject('infix-en_GB-jvm')
|
||||
testImplementation prefixedProject('api-infix-en_GB-kotlin_1_3-jvm')
|
||||
testRuntimeOnly prefixedProject('domain-robstoll-kotlin_1_3-jvm')
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ constructor(
|
||||
* @param representation The [BasicDescriptiveAssertion.representation].
|
||||
* @param holds Determines whether [BasicDescriptiveAssertion.holds] or not
|
||||
*/
|
||||
@Suppress("DEPRECATION" /* TODO remove with 1.0.0 */)
|
||||
@Suppress("DEPRECATION" /* TODO remove with 0.16.0 */)
|
||||
@Deprecated(
|
||||
"Use `AssertImpl.builder.descriptive` instead, will be made `internal` with 1.0.0",
|
||||
ReplaceWith(
|
||||
@@ -50,13 +50,5 @@ constructor(
|
||||
/**
|
||||
* @suppress
|
||||
*/
|
||||
override fun toString() = "$description: $representation (holds=${safeHoldsForToString()})"
|
||||
|
||||
private fun safeHoldsForToString(): String =
|
||||
//TODO remove try-catch with 1.0.0, should no longer be necessary
|
||||
try {
|
||||
holds().toString()
|
||||
} catch (@Suppress("DEPRECATION") e: ch.tutteli.atrium.creating.PlantHasNoSubjectException) {
|
||||
"PlantHasNoSubjectException"
|
||||
}
|
||||
override fun toString() = "$description: $representation (holds=${holds().toString()})"
|
||||
}
|
||||
|
||||
@@ -64,13 +64,7 @@ internal class FinalStepImpl(
|
||||
) : DescriptiveAssertionWithFailureHint.FinalStep {
|
||||
|
||||
override fun build(): Assertion {
|
||||
//TODO remove try catch with 1.0.0, should no longer be necessary
|
||||
val holds = try {
|
||||
test()
|
||||
} catch (@Suppress("DEPRECATION") e: ch.tutteli.atrium.creating.PlantHasNoSubjectException) {
|
||||
// failure hint does not need to be shown if plant is absent
|
||||
false
|
||||
}
|
||||
val holds = test()
|
||||
return if (holds || !showHint()) {
|
||||
assertionBuilder.createDescriptive(description, representation) { holds }
|
||||
} else {
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package ch.tutteli.atrium.checking
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.reporting.LazyRepresentation
|
||||
import ch.tutteli.atrium.reporting.translating.Translatable
|
||||
|
||||
/**
|
||||
* Checks given [Assertion]s and reports if one of them fails.
|
||||
*/
|
||||
@Deprecated("Do no longer use AssertionCheckers, use a specialised Expect instead; e.g. DelegatingExpect, FeatureExpect; will be removed with 1.0.0")
|
||||
interface AssertionChecker {
|
||||
|
||||
/**
|
||||
* Checks given [assertions] and reports if one of them fails (does not hold).
|
||||
*
|
||||
* @param assertionVerb The assertion verb which will be used in reporting.
|
||||
* @param representation The representation of the subject for which the [assertions]
|
||||
* have been created.
|
||||
* @param assertions The [assertions] which shall be checked.
|
||||
*
|
||||
* @throws AssertionError An implementation is allowed to throw [AssertionError] if an assertion fails.
|
||||
*/
|
||||
fun check(assertionVerb: Translatable, representation: Any?, assertions: List<Assertion>)
|
||||
|
||||
@Deprecated(
|
||||
"Use the overload which expects a representation instead of a representationProvider, use LazyRepresentation if needed; will be removed with 1.0.0",
|
||||
ReplaceWith("check(assertionVerb, LazyRepresentation(representationProvider), assertions)")
|
||||
)
|
||||
fun check(assertionVerb: Translatable, representationProvider: () -> Any, assertions: List<Assertion>) =
|
||||
check(assertionVerb, LazyRepresentation(representationProvider), assertions)
|
||||
}
|
||||
@@ -52,400 +52,6 @@ expect interface CoreFactory : CoreFactoryCommon
|
||||
*/
|
||||
interface CoreFactoryCommon {
|
||||
|
||||
/**
|
||||
* Creates a [ReportingAssertionPlant] which checks and reports added [Assertion]s.
|
||||
*
|
||||
* It creates a [newThrowingAssertionChecker] based on the given [reporter] for assertion checking,
|
||||
* uses [subjectProvider] as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* Notice that [evalOnce] is applied to the given [subjectProvider] to avoid undesired side effects
|
||||
* (the provider is most likely called more than once).
|
||||
*
|
||||
* @param assertionVerb The assertion verb which will be used inter alia in reporting
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* @param subjectProvider Used as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but
|
||||
* also as [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* @param reporter The reporter which will be used for a [newThrowingAssertionChecker].
|
||||
*
|
||||
* @return The newly created assertion plant.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"Switch to Expect instead of Assert, thus use newReportingAssertionContainer instead; will be removed with 1.0.0",
|
||||
ReplaceWith(
|
||||
"ExpectBuilder.forSubject(\n" +
|
||||
"// define the subject here instead of subjectProvider(), for instance just `subject` instead of `{ subject }`\n" +
|
||||
"// in case you have a transformation from an existing subject, then use this.maybeSubject.map { transform(it) }\n" +
|
||||
"subjectProvider()\n" +
|
||||
")\n" +
|
||||
".withVerb(assertionVerb)\n" +
|
||||
".withOptions { withReporter(reporter) }\n" +
|
||||
".build()",
|
||||
"ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder"
|
||||
)
|
||||
)
|
||||
fun <T : Any> newReportingPlant(
|
||||
assertionVerb: Translatable,
|
||||
subjectProvider: () -> T,
|
||||
reporter: Reporter
|
||||
): ReportingAssertionPlant<T> = newReportingPlant(
|
||||
assertionVerb, subjectProvider, newThrowingAssertionChecker(reporter)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates a [ReportingAssertionContainer] which delegates checking and reporting [Assertion]s to the given
|
||||
* [originalAssertionHolder].
|
||||
*
|
||||
* In Detail: it uses [SHOULD_NOT_BE_SHOWN_TO_THE_USER_BUG_TRANSLATABLE] as assertion verb and creates an
|
||||
* delegating [ch.tutteli.atrium.checking.AssertionChecker] via [newDelegatingAssertionChecker].
|
||||
*
|
||||
* @param maybeSubject Used as [ReportingAssertionContainer.maybeSubject] and
|
||||
* also as representation in reporting.
|
||||
*
|
||||
* @return The newly created assertion container.
|
||||
*/
|
||||
@Suppress("DeprecatedCallableAddReplaceWith", "DEPRECATION")
|
||||
@Deprecated(
|
||||
"Use DelegatingExpect(...) instead which does not use an AssertionChecker; will be removed with 1.0.0",
|
||||
ReplaceWith("DelegatingExpect(originalAssertionHolder, maybeSubject)")
|
||||
)
|
||||
fun <T> newDelegatingReportingAssertionContainer(
|
||||
originalAssertionHolder: AssertionHolder,
|
||||
maybeSubject: Option<T>
|
||||
): Expect<T> = DelegatingExpect(originalAssertionHolder, maybeSubject)
|
||||
|
||||
/**
|
||||
* Creates a [ReportingAssertionContainer] which checks and reports added [Assertion]s.
|
||||
*
|
||||
* It uses the given [assertionChecker] for assertion checking, uses [maybeSubject] as
|
||||
* [ReportingAssertionContainer.maybeSubject] and also as representation in reporting.
|
||||
*
|
||||
* @param assertionVerb The assertion verb which will be used inter alia in reporting.
|
||||
* @param maybeSubject Used as [ReportingAssertionContainer.maybeSubject] and
|
||||
* also as representation in reporting.
|
||||
* @param assertionChecker The checker which will be used to check [Assertion]s.
|
||||
* (see [ReportingAssertionContainer.AssertionCheckerDecorator.assertionChecker]).
|
||||
*
|
||||
* @return The newly created assertion container.
|
||||
*/
|
||||
@Suppress("DeprecatedCallableAddReplaceWith", "DEPRECATION")
|
||||
@Deprecated("Use RootExpect(...) or DelegatingExpect(..) or FeatureExpect(...) which all do not use a deprecated AssertionChecker; will be removed with 1.0.0")
|
||||
fun <T> newReportingAssertionContainer(
|
||||
assertionVerb: Translatable,
|
||||
maybeSubject: Option<T>,
|
||||
assertionChecker: ch.tutteli.atrium.checking.AssertionChecker
|
||||
): ReportingAssertionContainer<T> {
|
||||
return newReportingAssertionContainer(
|
||||
ReportingAssertionContainer.AssertionCheckerDecorator.create(
|
||||
assertionVerb,
|
||||
maybeSubject,
|
||||
maybeSubject.getOrElse { Text(SHOULD_NOT_BE_SHOWN_TO_THE_USER_BUG) },
|
||||
assertionChecker
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a [ReportingAssertionPlant] which checks and reports added [Assertion]s.
|
||||
*
|
||||
* It uses the given [assertionChecker] for assertion checking, uses [subjectProvider] as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* Notice that [evalOnce] is applied to the given [subjectProvider] to avoid side effects
|
||||
* (the provider is most likely called more than once).
|
||||
*
|
||||
* @param assertionVerb The assertion verb which will be used inter alia in reporting
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* @param subjectProvider Used as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but
|
||||
* also as [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* @param assertionChecker The checker which will be used to check [Assertion]s.
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionChecker]).
|
||||
*
|
||||
* @return The newly created assertion plant.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"Switch to Expect instead of Assert, thus use newReportingAssertionContainer instead; will be removed with 1.0.0",
|
||||
ReplaceWith(
|
||||
"this.newReportingAssertionContainer(\n" +
|
||||
"assertionVerb,\n" +
|
||||
"// define the subject here instead of subjectProvider(), for instance just `subject` instead of `{ subject }`\n" +
|
||||
"// in case you have a transformation from an existing subject, then use this.maybeSubject.map { transform(it) }\n" +
|
||||
"Some(subjectProvider()),\n" +
|
||||
"assertionChecker\n" +
|
||||
")",
|
||||
"ch.tutteli.atrium.core.coreFactory",
|
||||
"ch.tutteli.atrium.core.Some",
|
||||
"ch.tutteli.atrium.domain.builders.ExpectImpl"
|
||||
)
|
||||
)
|
||||
fun <T : Any> newReportingPlant(
|
||||
assertionVerb: Translatable,
|
||||
subjectProvider: () -> T,
|
||||
assertionChecker: ch.tutteli.atrium.checking.AssertionChecker
|
||||
): ReportingAssertionPlant<T> {
|
||||
val evalOnceSubjectProvider = subjectProvider.evalOnce()
|
||||
return newReportingPlant(
|
||||
AssertionPlantWithCommonFields.CommonFields(
|
||||
assertionVerb,
|
||||
evalOnceSubjectProvider,
|
||||
evalOnceSubjectProvider,
|
||||
assertionChecker,
|
||||
Text.NULL
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a [ReportingAssertionContainer] which checks and reports added [Assertion]s.
|
||||
*
|
||||
* It uses the given [assertionCheckerDecorator] for assertion checking.
|
||||
*
|
||||
* @param assertionCheckerDecorator The [ReportingAssertionContainer.AssertionCheckerDecorator] which will
|
||||
* be used for assertion checking.
|
||||
*
|
||||
* @return The newly created assertion container.
|
||||
*/
|
||||
@Suppress("DeprecatedCallableAddReplaceWith", "DEPRECATION")
|
||||
@Deprecated("Use RootExpect(...) or DelegatingExpect(..) or FeatureExpect(...) which all do not use a deprecated AssertionChecker; will be removed with 1.0.0")
|
||||
fun <T> newReportingAssertionContainer(
|
||||
assertionCheckerDecorator: ReportingAssertionContainer.AssertionCheckerDecorator<T>
|
||||
): ReportingAssertionContainer<T>
|
||||
|
||||
/**
|
||||
* Creates a [ReportingAssertionPlant] which checks and reports added [Assertion]s.
|
||||
*
|
||||
* It uses the [AssertionPlantWithCommonFields.CommonFields.assertionChecker] of the given [commonFields] for
|
||||
* assertion checking
|
||||
*
|
||||
* @param commonFields The commonFields for the new assertion plant.
|
||||
*
|
||||
* @return The newly created assertion plant.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"Switch to Expect instead of Assert, thus use newReportingAssertionContainer instead; will be removed with 1.0.0",
|
||||
ReplaceWith("this.newReportingAssertionContainer(commonFields)")
|
||||
)
|
||||
fun <T : Any> newReportingPlant(
|
||||
commonFields: AssertionPlantWithCommonFields.CommonFields<T>
|
||||
): ReportingAssertionPlant<T>
|
||||
|
||||
/**
|
||||
* Creates a [ReportingAssertionPlant] which [AssertionPlant.addAssertionsCreatedBy] the
|
||||
* given [assertionCreator] lambda where the created [Assertion]s are added as a group and usually (depending on
|
||||
* the configured [Reporter]) reported as a whole.
|
||||
*
|
||||
* It creates a [CoreFactory.newThrowingAssertionChecker] based on the given [reporter] for assertion checking,
|
||||
* uses [subjectProvider] as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* Notice that [evalOnce] is applied to the given [subjectProvider] to avoid side effects
|
||||
* (the provider is most likely called more than once).
|
||||
*
|
||||
* @param assertionVerb The assertion verb which will be used inter alia in reporting
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* @param subjectProvider Used as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but
|
||||
* also as [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* @param reporter The reporter which will be used for a [newThrowingAssertionChecker].
|
||||
* @param assertionCreator The
|
||||
*
|
||||
* @return The newly created [AssertionPlant] which can be used to postulate further assertions.
|
||||
*
|
||||
* @throws AssertionError The newly created [AssertionPlant] might throw an [AssertionError] in case a
|
||||
* created [Assertion] does not hold.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"Switch to Expect instead of Assert, thus use newReportingAssertionContainer instead; will be removed with 1.0.0",
|
||||
ReplaceWith(
|
||||
"ExpectBuilder.forSubject(\n" +
|
||||
"// !!!! in case you define an assertion verb function, remove it entirely, this is no longer required !!!! otherwise:\n" +
|
||||
"// define the subject here instead of subjectProvider(), for instance just `subject` instead of `{ subject }`\n" +
|
||||
"// in case you have a transformation from an existing subject, then use this.maybeSubject.map { transform(it) }\n" +
|
||||
"subjectProvider()\n" +
|
||||
")\n" +
|
||||
".withVerb(assertionVerb)\n" +
|
||||
".withOptions { withReporter(reporter) }\n" +
|
||||
".build()\n" +
|
||||
".addAssertionsCreatedBy(assertionCreator)",
|
||||
"ch.tutteli.atrium.domain.builders.reporting.ExpectBuilder"
|
||||
)
|
||||
)
|
||||
fun <T : Any> newReportingPlantAndAddAssertionsCreatedBy(
|
||||
assertionVerb: Translatable,
|
||||
subjectProvider: () -> T,
|
||||
reporter: Reporter,
|
||||
assertionCreator: AssertionPlant<T>.() -> Unit
|
||||
) = newReportingPlant(assertionVerb, subjectProvider, reporter)
|
||||
.addAssertionsCreatedBy(assertionCreator)
|
||||
|
||||
/**
|
||||
* Creates a [ReportingAssertionPlantNullable] which is the entry point for assertions about nullable types.
|
||||
*
|
||||
* It uses the [AssertionPlantWithCommonFields.CommonFields.assertionChecker] of the given [commonFields] for
|
||||
* assertion checking.
|
||||
*
|
||||
* @param commonFields The commonFields for the new assertion plant.
|
||||
*
|
||||
* @return The newly created assertion plant.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"Switch to Expect instead of Assert, thus use newReportingAssertionContainer instead; will be removed with 1.0.0",
|
||||
ReplaceWith("this.newReportingAssertionContainer(commonFields)")
|
||||
)
|
||||
fun <T : Any?> newReportingPlantNullable(commonFields: AssertionPlantWithCommonFields.CommonFields<T>): ReportingAssertionPlantNullable<T>
|
||||
|
||||
/**
|
||||
* Creates a [CheckingAssertionPlant] which provides a method to check whether
|
||||
* [allAssertionsHold][CheckingAssertionPlant.allAssertionsHold].
|
||||
*
|
||||
* @param subjectProvider The provider which provides the subject for which this plant will
|
||||
* create and check [Assertion]s.
|
||||
*
|
||||
* @return The newly created assertion plant.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"Switch from Assert to Expect and use newCollectingAssertionContainer instead, there is no CheckingAssertionContainer, you can use `getAsssertions.holds()`; will be removed with 1.0.0",
|
||||
ReplaceWith(
|
||||
"this.newCollectingAssertionContainer(\n" +
|
||||
"// define the subject here instead of subjectProvider(), for instance just `subject` instead of `{ subject }`\n" +
|
||||
"// in case you have a transformation from an existing subject, then use this.maybeSubject.map { transform(it) }\n" +
|
||||
"Some(subjectProvider())\n" +
|
||||
")",
|
||||
"ch.tutteli.atrium.core.Some"
|
||||
)
|
||||
)
|
||||
fun <T : Any> newCheckingPlant(subjectProvider: () -> T): CheckingAssertionPlant<T>
|
||||
|
||||
/**
|
||||
* Creates a [CollectingAssertionContainer] which is intended to be used as receiver object in lambdas so that it
|
||||
* can collect [Assertion]s created inside the lambda.
|
||||
*
|
||||
* @param maybeSubject Either [Some] wrapping the subject of the current assertion or
|
||||
* [None] in case a previous subject change was not successful.
|
||||
*
|
||||
* @return The newly created assertion container.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"Use CollectingExpect instead; will be removed with 1.0.0",
|
||||
ReplaceWith("(maybeSubject)", "ch.tutteli.atrium.creating.CollectingExpect")
|
||||
)
|
||||
fun <T> newCollectingAssertionContainer(maybeSubject: Option<T>): CollectingAssertionContainer<T>
|
||||
|
||||
/**
|
||||
* Creates a [CollectingAssertionPlant] which is intended to be used as receiver object in lambdas to
|
||||
* collect created [Assertion]s inside the lambda.
|
||||
*
|
||||
* Notice, that the plant might not provide a [CollectingAssertionPlant.subject] in which case it
|
||||
* throws a [PlantHasNoSubjectException] if subject is accessed.
|
||||
* Use [newCheckingPlant] instead if you want to know whether the assertions hold.
|
||||
*
|
||||
* @param subjectProvider The function which will either provide the subject for this plant or throw an
|
||||
* [PlantHasNoSubjectException] in case it cannot provide it. A [CollectingAssertionPlant] should evaluate the
|
||||
* [subjectProvider] only once.
|
||||
*
|
||||
* @return The newly created assertion plant.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"Switch to Expect instead of Assert, thus use newCollectingAssertionContainer instead; will be removed with 1.0.0",
|
||||
ReplaceWith(
|
||||
"this.newCollectingAssertionContainer(\n" +
|
||||
"// define the subject here instead of subjectProvider(), for instance just `subject` instead of `{ subject }`\n" +
|
||||
"// in case you have a transformation from an existing subject, then use this.maybeSubject.map { transform(it) }\n" +
|
||||
"Some(subjectProvider())\n" +
|
||||
")",
|
||||
"ch.tutteli.atrium.core.Some"
|
||||
)
|
||||
)
|
||||
fun <T : Any> newCollectingPlant(subjectProvider: () -> T): CollectingAssertionPlant<T>
|
||||
|
||||
|
||||
/**
|
||||
* Creates a [CollectingAssertionPlantNullable] which is intended to be used as receiver object in lambdas to
|
||||
* collect created [Assertion]s inside the lambda.
|
||||
*
|
||||
* Notice, that the plant might not provide a [CollectingAssertionPlantNullable.subject] in which case it
|
||||
* throws a [PlantHasNoSubjectException] if subject is accessed.
|
||||
*
|
||||
* @param subjectProvider The function which will either provide the subject for this plant or throw an
|
||||
* [PlantHasNoSubjectException] in case it cannot provide it. A [CollectingAssertionPlant] should evaluate the
|
||||
* [subjectProvider] only once.
|
||||
*
|
||||
* @return The newly created assertion plant.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"Switch to Expect instead of Assert, thus use newCollectingAssertionContainer instead; will be removed with 1.0.0",
|
||||
ReplaceWith(
|
||||
"this.newCollectingAssertionContainer(\n" +
|
||||
"// define the subject here instead of subjectProvider(), for instance just `subject` instead of `{ subject }`\n" +
|
||||
"// in case you have a transformation from an existing subject, then use this.maybeSubject.map { transform(it) }\n" +
|
||||
"Some(subjectProvider())\n" +
|
||||
")",
|
||||
"ch.tutteli.atrium.core.Some"
|
||||
)
|
||||
)
|
||||
fun <T> newCollectingPlantNullable(subjectProvider: () -> T): CollectingAssertionPlantNullable<T>
|
||||
|
||||
|
||||
/**
|
||||
* Creates an [ch.tutteli.atrium.checking.AssertionChecker] which throws [AtriumError]s in case an assertion fails
|
||||
* and uses the given [reporter] for reporting.
|
||||
*
|
||||
* @param reporter The reporter which is used to report [Assertion]s.
|
||||
*
|
||||
* @return The newly created assertion checker.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Do no longer use AssertionCheckers, use a specialised Expect instead; e.g. DelegatingExpect, FeaturExpect; will be removed with 1.0.0")
|
||||
fun newThrowingAssertionChecker(reporter: Reporter): ch.tutteli.atrium.checking.AssertionChecker
|
||||
|
||||
/**
|
||||
* Creates an [ch.tutteli.atrium.checking.AssertionChecker] which creates an [AssertionGroup] of [type][AssertionGroup.type]
|
||||
* [FeatureAssertionGroupType] instead of checking assertions and delegates this task to the given
|
||||
* [originalAssertionHolder] by adding (see [AssertionPlant.addAssertion]) the created assertion group to it.
|
||||
*
|
||||
* @param originalAssertionHolder The assertion plant to which the created [AssertionGroup] of [type][AssertionGroup.type]
|
||||
* [FeatureAssertionGroupType] will be [added][AssertionPlant.addAssertion].
|
||||
*
|
||||
* @return The newly created assertion checker.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Do no longer use AssertionCheckers, use a specialised Expect instead; e.g. DelegatingExpect, FeatureExpect; will be removed with 1.0.0")
|
||||
fun newFeatureAssertionChecker(originalAssertionHolder: AssertionHolder): ch.tutteli.atrium.checking.AssertionChecker
|
||||
|
||||
/**
|
||||
* Creates an [ch.tutteli.atrium.checking.AssertionChecker] which delegates the checking of [Assertion]s to the given
|
||||
* [originalAssertionHolder] by adding (see [AssertionHolder.addAssertion]) the assertions to the given
|
||||
* [originalAssertionHolder].
|
||||
*
|
||||
* @param originalAssertionHolder The assertion container to which the [Assertion]s will
|
||||
* be [added][AssertionPlant.addAssertion].
|
||||
*
|
||||
* @return The newly created assertion checker.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Do no longer use AssertionCheckers, use a specialised Expect instead; e.g. DelegatingExpect, FeatureExpect; will be removed with 1.0.0")
|
||||
fun newDelegatingAssertionChecker(originalAssertionHolder: AssertionHolder): ch.tutteli.atrium.checking.AssertionChecker
|
||||
|
||||
|
||||
/**
|
||||
* Creates an [ch.tutteli.atrium.checking.AssertionChecker] which delegates the checking of [Assertion]s to the given [subjectPlant]
|
||||
* by adding (see [AssertionPlant.addAssertion]) the assertions to the given [subjectPlant].
|
||||
*
|
||||
* @param subjectPlant The assertion plant to which the [Assertion]s will be [added][AssertionPlant.addAssertion].
|
||||
*
|
||||
* @return The newly created assertion checker.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Do no longer use AssertionCheckers, use a specialised Expect instead; e.g. DelegatingExpect, FeatureExpect; will be removed with 1.0.0")
|
||||
fun <T> newDelegatingAssertionChecker(subjectPlant: BaseAssertionPlant<T, *>): ch.tutteli.atrium.checking.AssertionChecker
|
||||
|
||||
|
||||
/**
|
||||
* Creates a [MethodCallFormatter] which represents arguments of a method call by using their [Any.toString]
|
||||
* representation with the exception of:
|
||||
@@ -742,98 +348,3 @@ interface CoreFactoryCommon {
|
||||
otherAdjusters: List<AtriumErrorAdjuster>
|
||||
): AtriumErrorAdjuster
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a [ReportingAssertionPlantNullable] which is the entry point for assertions about nullable types.
|
||||
*
|
||||
* It creates a [CoreFactory.newThrowingAssertionChecker] based on the given [reporter] for assertion checking,
|
||||
* uses [subjectProvider] as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* Notice that [evalOnce] is applied to the given [subjectProvider] to avoid side effects
|
||||
* (the provider is most likely called more than once).
|
||||
*
|
||||
* @param assertionVerb The assertion verb which will be used inter alia in reporting
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* @param subjectProvider Used as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but
|
||||
* also as [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* @param reporter The reporter which will be used for a [CoreFactory.newThrowingAssertionChecker].
|
||||
*
|
||||
* @return The newly created assertion plant.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"Switch to Expect instead of Assert, thus use newReportingAssertionContainer instead; will be removed with 1.0.0",
|
||||
ReplaceWith(
|
||||
"ExpectImpl\n" +
|
||||
".assertionVerbBuilder(\n" +
|
||||
"// define the subject here instead of subjectProvider(), for instance just `subject` instead of `{ subject }`\n" +
|
||||
"// in case you have a transformation from an existing subject, then use this.maybeSubject.map { transform(it) }\n" +
|
||||
"subjectProvider()\n" +
|
||||
")\n" +
|
||||
".withVerb(assertionVerb)\n" +
|
||||
".withCustomReporter(reporter)\n" +
|
||||
".build()",
|
||||
"ch.tutteli.atrium.domain.builders.ExpectImpl"
|
||||
)
|
||||
)
|
||||
fun <T : Any?> CoreFactoryCommon.newReportingPlantNullable(
|
||||
assertionVerb: Translatable,
|
||||
subjectProvider: () -> T,
|
||||
reporter: Reporter,
|
||||
nullRepresentation: Any = Text.NULL
|
||||
): ReportingAssertionPlantNullable<T> = newReportingPlantNullable(
|
||||
assertionVerb, subjectProvider, newThrowingAssertionChecker(reporter), nullRepresentation
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates a [ReportingAssertionPlantNullable] which is the entry point for assertions about nullable types.
|
||||
*
|
||||
* It uses the given [assertionChecker] for assertion checking, uses [subjectProvider] as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but also as
|
||||
* [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* Notice that [evalOnce] is applied to the given [subjectProvider] to avoid side effects
|
||||
* (the provider is most likely called more than once).
|
||||
*
|
||||
* @param assertionVerb The assertion verb which will be used inter alia in reporting
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionVerb]).
|
||||
* @param subjectProvider Used as [AssertionPlantWithCommonFields.CommonFields.subjectProvider] but
|
||||
* also as [AssertionPlantWithCommonFields.CommonFields.representationProvider].
|
||||
* @param assertionChecker The checker which will be used to check [Assertion]s.
|
||||
* (see [AssertionPlantWithCommonFields.CommonFields.assertionChecker]).
|
||||
*
|
||||
* @return The newly created assertion plant.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"Switch to Expect instead of Assert, thus use newReportingAssertionContainer instead; will be removed with 1.0.0",
|
||||
ReplaceWith(
|
||||
"this.newReportingAssertionContainer(\n" +
|
||||
"assertionVerb,\n" +
|
||||
"// define the subject here instead of subjectProvider(), for instance just `subject` instead of `{ subject }`\n" +
|
||||
"// in case you have a transformation from an existing subject, then use this.maybeSubject.map { transform(it) }\n" +
|
||||
"Some(subjectProvider()),\n" +
|
||||
"assertionChecker\n" +
|
||||
")",
|
||||
"ch.tutteli.atrium.core.coreFactory",
|
||||
"ch.tutteli.atrium.core.Some",
|
||||
"ch.tutteli.atrium.domain.builders.ExpectImpl"
|
||||
)
|
||||
)
|
||||
fun <T : Any?> CoreFactoryCommon.newReportingPlantNullable(
|
||||
assertionVerb: Translatable,
|
||||
subjectProvider: () -> T,
|
||||
assertionChecker: ch.tutteli.atrium.checking.AssertionChecker,
|
||||
nullRepresentation: Any = Text.NULL
|
||||
): ReportingAssertionPlantNullable<T> {
|
||||
val evalOnceSubjectProvider = subjectProvider.evalOnce()
|
||||
return newReportingPlantNullable(
|
||||
AssertionPlantWithCommonFields.CommonFields(
|
||||
assertionVerb,
|
||||
evalOnceSubjectProvider,
|
||||
evalOnceSubjectProvider,
|
||||
assertionChecker,
|
||||
nullRepresentation
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
@file:Suppress("DEPRECATION" /* TODO remove file with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.creating
|
||||
|
||||
/**
|
||||
* Type alias for [AssertionPlant] which should be used in API modules.
|
||||
*/
|
||||
@Deprecated("Switch from Assert to Expect; will be removed with 1.0.0")
|
||||
typealias Assert<T> = AssertionPlant<T>
|
||||
|
||||
/**
|
||||
* DSL Marker for [AssertionPlant] (and its type alias [Assert]).
|
||||
*/
|
||||
@DslMarker
|
||||
@Deprecated("Switch from AssertMarker to ExpectMarker; will be removed with 1.0.0")
|
||||
annotation class AssertMarker
|
||||
@@ -1,50 +0,0 @@
|
||||
@file:Suppress("DEPRECATION" /* will be removed with 1.0.0 */)
|
||||
|
||||
package ch.tutteli.atrium.creating
|
||||
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.assertions.DescriptiveAssertion
|
||||
import ch.tutteli.atrium.assertions.builders.assertionBuilder
|
||||
import ch.tutteli.atrium.reporting.translating.Translatable
|
||||
|
||||
/**
|
||||
* Represents a plant for [Assertion]s based on a non nullable [subject].
|
||||
*
|
||||
* It is the entry point for most assertion functions and provides only a reduced set of [ReportingAssertionPlant]
|
||||
* which is actually created when a user of Atrium is using an assertion verb function.
|
||||
*
|
||||
* @param T The type of the [subject] of this [AssertionPlant].
|
||||
*/
|
||||
@AssertMarker
|
||||
@Deprecated("Switch from AssertionPlant to Expect; will be removed with 1.0.0", ReplaceWith("Expect"))
|
||||
interface AssertionPlant<out T : Any> : BaseAssertionPlant<T, AssertionPlant<T>> {
|
||||
|
||||
/**
|
||||
* Adds the assertions created by the [assertionCreator] lambda to this plant.
|
||||
*
|
||||
* @param assertionCreator The receiver function which might create and add assertions to this plant.
|
||||
*
|
||||
* @return This plant to support a fluent API.
|
||||
*
|
||||
* @throws AssertionError Might throw an [AssertionError] in case [Assertion]s are immediately
|
||||
* evaluated (see [ReportingAssertionPlant]).
|
||||
*/
|
||||
fun addAssertionsCreatedBy(assertionCreator: AssertionPlant<T>.() -> Unit): AssertionPlant<T>
|
||||
|
||||
/**
|
||||
* Creates a [DescriptiveAssertion] based on the given [description], [expected] and [test] and
|
||||
* [adds][addAssertion] it to the plant.
|
||||
*
|
||||
* @param description The description of the assertion, e.g., `is less than`.
|
||||
* @param expected The expected value, e.g., `5`
|
||||
* @param test Indicates whether the assertion holds or fails.
|
||||
*
|
||||
* @return This plant to support a fluent API.
|
||||
*
|
||||
* @throws AssertionError Might throw an [AssertionError] in case [Assertion]s are immediately
|
||||
* evaluated (see [ReportingAssertionPlant]).
|
||||
*/
|
||||
fun createAndAddAssertion(description: Translatable, expected: Any, test: () -> Boolean): AssertionPlant<T> =
|
||||
addAssertion(assertionBuilder.createDescriptive(description, expected, test))
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user