mirror of
https://github.com/jlengrand/atrium.git
synced 2026-03-10 08:01:19 +00:00
Merge pull request #903 from robstoll/to-plus-infinitive
renaming throwableAssertions to consistent to + infitinive naming schema
This commit is contained in:
@@ -1879,7 +1879,7 @@ expect {
|
||||
} catch (t: Throwable) {
|
||||
throw IllegalArgumentException("no no no...", t)
|
||||
}
|
||||
}.toThrow<IllegalStateException> { messageContains("no no no") }
|
||||
}.toThrow<IllegalStateException> { messageToContain("no no no") }
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L243)</sub> ↓ <sub>[Output](#ex-add-info-3)</sub>
|
||||
<a name="ex-add-info-3"></a>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to charSequenceToContain... in 0.18.0
|
||||
//TODO remove JvmMultifileClass with 1.0.0
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceContainsCheckersKt")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to charSequenceToContain... in 0.18.0
|
||||
//TODO remove JvmMultifileClass with 1.0.0
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceContainsCreatersKt")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to charSequenceToContain... in 0.18.0
|
||||
//TODO remove JvmMultifileClass with 1.0.0
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceContainsSearchBehavioursKt")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to iterableLikeToContain... in 0.18.0
|
||||
//TODO remove both annotations with 1.0.0
|
||||
@file:JvmName("IterableContainsCheckers")
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to iterableLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to iterableLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to iterableLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to iterableLikeToContain... in 0.18.0
|
||||
//TODO remove file with 1.0.0
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to iterableLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.logic.creating.typeutils.IterableLike
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to mapLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to mapLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to mapLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to mapLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.logic.creating.typeutils.MapLike
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to pairExpectations in 0.18.0
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to sequenceExpectations in 0.18.0
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
|
||||
@@ -7,6 +7,7 @@ import ch.tutteli.atrium.logic.causeIsA
|
||||
import ch.tutteli.atrium.logic.creating.transformers.SubjectChangerBuilder
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
//TODO move to throwableExpectations.kt with 0.18.0
|
||||
/**
|
||||
* Expects that the property [Throwable.message] of the subject of `this` expectation is not null,
|
||||
* creates an [Expect] for it and returns it.
|
||||
@@ -16,6 +17,7 @@ import kotlin.reflect.KClass
|
||||
val <T : Throwable> Expect<T>.message: Expect<String>
|
||||
get() = feature(Throwable::message).notToEqualNull()
|
||||
|
||||
//TODO move to throwableExpectations.kt with 0.18.0
|
||||
/**
|
||||
* Expects that the property [Throwable.message] of the subject of `this` expectation is not null and
|
||||
* holds all assertions the given [assertionCreator] creates for it and
|
||||
@@ -40,12 +42,19 @@ fun <T : Throwable> Expect<T>.message(assertionCreator: Expect<String>.() -> Uni
|
||||
*
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use messageToContain; will be removed with 1.0.0 at the latest",
|
||||
ReplaceWith(
|
||||
"this.messageToContain<T>(expected, *otherExpected)",
|
||||
"ch.tutteli.atrium.api.fluent.en_GB.messageToContain"
|
||||
)
|
||||
)
|
||||
fun <T : Throwable> Expect<T>.messageContains(
|
||||
expected: CharSequenceOrNumberOrChar,
|
||||
vararg otherExpected: CharSequenceOrNumberOrChar
|
||||
): Expect<T> = message { toContain(expected, *otherExpected) }
|
||||
|
||||
|
||||
//TODO move to throwableExpectations.kt with 0.18.0
|
||||
/**
|
||||
* Expects that the property [Throwable.cause] of the subject *is a* [TExpected] (the same type or a sub-type),
|
||||
* creates an [Expect] of the [TExpected] type for it and returns it.
|
||||
@@ -57,12 +66,13 @@ fun <T : Throwable> Expect<T>.messageContains(
|
||||
inline fun <reified TExpected : Throwable> Expect<out Throwable>.cause(): Expect<TExpected> =
|
||||
causeIsA(TExpected::class).transform()
|
||||
|
||||
//TODO move to throwableExpectations.kt with 0.18.0 and rename to causeIsInstanceOf
|
||||
@PublishedApi // in order that _logic does not become part of the API we have this extra function
|
||||
internal fun <TExpected : Throwable> Expect<out Throwable>.causeIsA(
|
||||
kClass: KClass<TExpected>
|
||||
): SubjectChangerBuilder.ExecutionStep<Throwable?, TExpected> = _logic.causeIsA(kClass)
|
||||
|
||||
|
||||
//TODO move to throwableExpectations.kt with 0.18.0
|
||||
/**
|
||||
*
|
||||
* Expects that the property [Throwable.cause] of the subject *is a* [TExpected] (the same type or a sub-type) and
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package ch.tutteli.atrium.api.fluent.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.logic.creating.typeutils.CharSequenceOrNumberOrChar
|
||||
import ch.tutteli.atrium.logic._logic
|
||||
import ch.tutteli.atrium.logic.causeIsA
|
||||
import ch.tutteli.atrium.logic.creating.transformers.SubjectChangerBuilder
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
/**
|
||||
* Expects that the property [Throwable.message] of the subject of `this` expectation is not null and contains
|
||||
* [expected]'s [toString] representation and the [toString] representation of the [otherExpected] (if given),
|
||||
* using a non disjoint search.
|
||||
*
|
||||
* It is more or less a shortcut for `message { contains.atLeast(1).values(expected, otherExpected) }`, depending on
|
||||
* the implementation though.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
fun <T : Throwable> Expect<T>.messageToContain(
|
||||
expected: CharSequenceOrNumberOrChar,
|
||||
vararg otherExpected: CharSequenceOrNumberOrChar
|
||||
): Expect<T> = message { toContain(expected, *otherExpected) }
|
||||
@@ -6,7 +6,7 @@ import ch.tutteli.atrium.specs.*
|
||||
class ThrowableExpectationsSpec : ch.tutteli.atrium.specs.integration.ThrowableExpectationsSpec(
|
||||
property<Throwable, String>(Expect<Throwable>::message),
|
||||
fun1<Throwable, Expect<String>.() -> Unit>(Expect<Throwable>::message),
|
||||
fun2(Expect<Throwable>::messageContains),
|
||||
fun2(Expect<Throwable>::messageToContain),
|
||||
("cause" to Companion::causeFeature).withFeatureSuffix(),
|
||||
"cause" to Companion::cause
|
||||
) {
|
||||
@@ -31,7 +31,7 @@ class ThrowableExpectationsSpec : ch.tutteli.atrium.specs.integration.ThrowableE
|
||||
|
||||
a1.message
|
||||
a1 = a1.message {}
|
||||
a1 = a1.messageContains("asdf")
|
||||
a1 = a1.messageToContain("asdf")
|
||||
|
||||
a1.cause<ClassCastException>()
|
||||
a1.cause<ClassCastException> { }
|
||||
|
||||
@@ -72,7 +72,7 @@ class CollectionExpectationSamples {
|
||||
toBeGreaterThan(4) // still evaluated even though `isLessThan(1)` already fails,
|
||||
// use `.size.` if you want a fail fast behaviour
|
||||
}
|
||||
}.messageContains(
|
||||
}.messageToContain(
|
||||
"is less than: 1",
|
||||
"is greater than: 4"
|
||||
)
|
||||
|
||||
@@ -61,7 +61,7 @@ class ListExpectationSamples {
|
||||
toBeLessThan(0) // still evaluated even though `isGreaterThan(2)` already fails,
|
||||
// use `.get(index).` if you want a fail fast behaviour
|
||||
}
|
||||
}.messageContains(
|
||||
}.messageToContain(
|
||||
"is greater than: 2",
|
||||
"is less than: 0"
|
||||
)
|
||||
|
||||
@@ -3,17 +3,8 @@
|
||||
|
||||
package ch.tutteli.atrium.api.fluent.en_GB.samples.deprecated
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.contains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.containsNot
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.hasSize
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.isEmpty
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.isGreaterThan
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.isLessThan
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.isNotEmpty
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.message
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.*
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.samples.fails
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.size
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import kotlin.test.Test
|
||||
|
||||
@@ -58,7 +49,7 @@ class CollectionAssertionSamples {
|
||||
.size
|
||||
.isLessThan(1) // fails
|
||||
.isGreaterThan(4) // not reported because `isLessThan(1)` already fails
|
||||
// use `size { ... }` if you want that all assertions are evaluated
|
||||
// use `size { ... }` if you want that all assertions are evaluated
|
||||
}.message {
|
||||
contains("is less than: 1")
|
||||
containsNot("is greater than: 4")
|
||||
@@ -83,9 +74,9 @@ class CollectionAssertionSamples {
|
||||
.size {
|
||||
isLessThan(1) // fails
|
||||
isGreaterThan(4) // still evaluated even though `isLessThan(1)` already fails,
|
||||
// use `.size.` if you want a fail fast behaviour
|
||||
// use `.size.` if you want a fail fast behaviour
|
||||
}
|
||||
}.messageContains(
|
||||
}.messageToContain(
|
||||
"is less than: 1",
|
||||
"is greater than: 4"
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ class PairAssertionSamples {
|
||||
.first
|
||||
.isGreaterThan(2) // fails
|
||||
.isLessThan(0) // not reported because `isGreaterThan(2)` already fails
|
||||
// use `first { ... }` if you want that all assertions are evaluated
|
||||
// use `first { ... }` if you want that all assertions are evaluated
|
||||
}.message {
|
||||
contains("is greater than: 2")
|
||||
containsNot("is less than: 0")
|
||||
@@ -51,9 +51,9 @@ class PairAssertionSamples {
|
||||
.first {
|
||||
isGreaterThan(2) // fails
|
||||
isLessThan(0) // still evaluated even though `isGreaterThan(2)` already fails
|
||||
// use `.first.` if you want a fail fast behaviour
|
||||
// use `.first.` if you want a fail fast behaviour
|
||||
}
|
||||
}.messageContains(
|
||||
}.messageToContain(
|
||||
"is greater than: 2",
|
||||
"is less than: 0"
|
||||
)
|
||||
@@ -73,7 +73,7 @@ class PairAssertionSamples {
|
||||
.second
|
||||
.isGreaterThan(2) // fails
|
||||
.isLessThan(0) // not reported because `isGreaterThan(2)` already fails
|
||||
// use `second { ... }` if you want that all assertions are evaluated
|
||||
// use `second { ... }` if you want that all assertions are evaluated
|
||||
}.message {
|
||||
contains("is greater than: 2")
|
||||
containsNot("is less than: 0")
|
||||
@@ -100,9 +100,9 @@ class PairAssertionSamples {
|
||||
.second {
|
||||
isGreaterThan(2) // fails
|
||||
isLessThan(0) // still evaluated even though `isGreaterThan(2)` already fails,
|
||||
// use `.second.` if you want a fail fast behaviour
|
||||
// use `.second.` if you want a fail fast behaviour
|
||||
}
|
||||
}.messageContains(
|
||||
}.messageToContain(
|
||||
"is greater than: 2",
|
||||
"is less than: 0"
|
||||
)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to charSequenceToContain... in 0.18.0
|
||||
//TODO remove JvmMultifileClass with 1.0.0
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceContainsCheckersKt")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to charSequenceToContain... in 0.18.0
|
||||
//TODO remove JvmMultifileClass with 1.0.0
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceContainsCreatersKt")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to charSequenceToContain... in 0.18.0
|
||||
//TODO remove JvmMultifileClass with 1.0.0
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("CharSequenceContainsSearchBehavioursKt")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to iterableLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.contains.impl.StaticNames
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to iterableLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Entries
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to iterableLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Entries
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to iterableLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Entries
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to iterableLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.iterable.Order
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to iterableLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.logic.creating.typeutils.IterableLike
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to mapLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Pairs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to mapLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Pairs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to mapLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Pairs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to mapLikeToContain... in 0.18.0
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.logic.creating.typeutils.MapLike
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to pairExpectations in 0.18.0
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//TODO rename file to sequenceExpectations in 0.18.0
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
|
||||
@@ -8,6 +8,7 @@ import ch.tutteli.atrium.logic.causeIsA
|
||||
import ch.tutteli.atrium.logic.creating.transformers.SubjectChangerBuilder
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
//TODO move to throwableExpectations.kt with 0.18.0
|
||||
/**
|
||||
* Expects that the property [Throwable.message] of the subject of `this` expectation is not null,
|
||||
* creates an [Expect] for it and returns it.
|
||||
@@ -17,6 +18,7 @@ import kotlin.reflect.KClass
|
||||
val <T : Throwable> Expect<T>.message: Expect<String>
|
||||
get() = it feature Throwable::message notToEqualNull o
|
||||
|
||||
//TODO move to throwableExpectations.kt with 0.18.0
|
||||
/**
|
||||
* Expects that the property [Throwable.message] of the subject of `this` expectation is not null and
|
||||
* holds all assertions the given [assertionCreator] creates for it and
|
||||
@@ -37,8 +39,15 @@ infix fun <T : Throwable> Expect<T>.message(assertionCreator: Expect<String>.()
|
||||
*
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use messageToContain; will be removed with 1.0.0 at the latest",
|
||||
ReplaceWith(
|
||||
"this.messageToContain<T>(expected)",
|
||||
"ch.tutteli.atrium.api.infix.en_GB.messageToContain"
|
||||
)
|
||||
)
|
||||
infix fun <T : Throwable> Expect<T>.messageContains(expected: CharSequenceOrNumberOrChar): Expect<T> =
|
||||
this messageContains values(expected)
|
||||
this messageToContain values(expected)
|
||||
|
||||
/**
|
||||
* Expects that the property [Throwable.message] of the subject of `this` expectation is not null and contains
|
||||
@@ -52,9 +61,17 @@ infix fun <T : Throwable> Expect<T>.messageContains(expected: CharSequenceOrNumb
|
||||
*
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use messageToContain; will be removed with 1.0.0 at the latest",
|
||||
ReplaceWith(
|
||||
"this.messageToContain<T>(values)",
|
||||
"ch.tutteli.atrium.api.infix.en_GB.messageToContain"
|
||||
)
|
||||
)
|
||||
infix fun <T : Throwable> Expect<T>.messageContains(values: Values<Any>): Expect<T> =
|
||||
message { toContain(values) }
|
||||
|
||||
//TODO move to throwableExpectations.kt with 0.18.0
|
||||
/**
|
||||
* Expects that the property [Throwable.cause] of the subject *is a* [TExpected] (the same type or a sub-type),
|
||||
* creates an [Expect] of the [TExpected] type for it and returns it.
|
||||
@@ -66,12 +83,14 @@ infix fun <T : Throwable> Expect<T>.messageContains(values: Values<Any>): Expect
|
||||
inline fun <reified TExpected : Throwable> Expect<out Throwable>.cause(): Expect<TExpected> =
|
||||
causeIsA(TExpected::class).transform()
|
||||
|
||||
//TODO move to throwableExpectations.kt with 0.18.0 and rename to causeIsInstanceOf
|
||||
@PublishedApi // in order that _logic does not become part of the API we have this extra function
|
||||
internal fun <TExpected : Throwable> Expect<out Throwable>.causeIsA(
|
||||
kClass: KClass<TExpected>
|
||||
): SubjectChangerBuilder.ExecutionStep<Throwable?, TExpected> = _logic.causeIsA(kClass)
|
||||
|
||||
|
||||
//TODO move to throwableExpectations.kt with 0.18.0
|
||||
/**
|
||||
*
|
||||
* Expects that the property [Throwable.cause] of the subject *is a* [TExpected] (the same type or a sub-type) and
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package ch.tutteli.atrium.api.infix.en_GB
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.creating.Values
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.logic.creating.typeutils.CharSequenceOrNumberOrChar
|
||||
import ch.tutteli.atrium.logic._logic
|
||||
import ch.tutteli.atrium.logic.causeIsA
|
||||
import ch.tutteli.atrium.logic.creating.transformers.SubjectChangerBuilder
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
/**
|
||||
* Expects that the property [Throwable.message] of the subject of `this` expectation is not null and contains
|
||||
* [expected]'s [toString] representation 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.
|
||||
*
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
*/
|
||||
infix fun <T : Throwable> Expect<T>.messageToContain(expected: CharSequenceOrNumberOrChar): Expect<T> =
|
||||
this messageToContain values(expected)
|
||||
|
||||
/**
|
||||
* Expects that the property [Throwable.message] of the subject of `this` expectation is not null and contains
|
||||
* [values]'s [toString] representation using a non disjoint search.
|
||||
**
|
||||
* Notice that a runtime check applies which assures that only [CharSequence], [Number] and [Char] are passed
|
||||
* (this function expects `Any` for your convenience, so that you can mix [String] and [Int] for instance).
|
||||
*
|
||||
* @param values The values which are expected to be contained within [Throwable.message]
|
||||
* -- use the function `values(t, ...)` to create a [Values].
|
||||
*
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
*/
|
||||
infix fun <T : Throwable> Expect<T>.messageToContain(values: Values<Any>): Expect<T> =
|
||||
message { toContain(values) }
|
||||
@@ -18,8 +18,8 @@ class ThrowableExpectationsSpec : ch.tutteli.atrium.specs.integration.ThrowableE
|
||||
expected: Any,
|
||||
vararg otherExpected: Any
|
||||
): Expect<Throwable> =
|
||||
if (otherExpected.isEmpty()) expect messageContains expected
|
||||
else expect messageContains values(
|
||||
if (otherExpected.isEmpty()) expect messageToContain expected
|
||||
else expect messageToContain values(
|
||||
expected,
|
||||
*otherExpected
|
||||
)
|
||||
@@ -41,9 +41,9 @@ class ThrowableExpectationsSpec : ch.tutteli.atrium.specs.integration.ThrowableE
|
||||
|
||||
a1.message
|
||||
a1 = a1 message {}
|
||||
a1 = a1 messageContains "a"
|
||||
a1 = a1 messageContains 'a'
|
||||
a1 = a1 messageContains values(
|
||||
a1 = a1 messageToContain "a"
|
||||
a1 = a1 messageToContain 'a'
|
||||
a1 = a1 messageToContain values(
|
||||
"a",
|
||||
1,
|
||||
'b'
|
||||
|
||||
@@ -74,7 +74,7 @@ class CollectionExpectationSamples {
|
||||
it toBeGreaterThan 4 // isLessThan 1 fails, but isGreaterThan 4 still evaluated
|
||||
// use `.size.` if you want a fail fast behaviour
|
||||
}
|
||||
} messageContains values(
|
||||
} messageToContain values(
|
||||
"${isLessThanDescr}: 1",
|
||||
"${isGreaterThanDescr}: 4"
|
||||
)
|
||||
|
||||
@@ -64,7 +64,7 @@ class ListExpectationSamples {
|
||||
it toBeLessThan 0 // still evaluated even though `isGreaterThan(2)` already fails,
|
||||
// use `get index` if you want a fail fast behaviour
|
||||
}
|
||||
} messageContains values(
|
||||
} messageToContain values(
|
||||
"${toBeGreaterThanDescr}: 2",
|
||||
"${toBeLessThanDescr}: 0"
|
||||
)
|
||||
|
||||
@@ -42,7 +42,7 @@ class SmokeTest {
|
||||
(assert(2).toEqual(1))
|
||||
}
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"${AssertionVerb.ASSERT.getDefault()}: 1",
|
||||
"${AssertionVerb.ASSERT.getDefault()}: 2",
|
||||
"${TO_BE.getDefault()}: 1"
|
||||
@@ -59,7 +59,7 @@ class SmokeTest {
|
||||
assertThat(2).toEqual(1)
|
||||
}
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"${AssertionVerb.ASSERT_THAT.getDefault()}: 1",
|
||||
"${AssertionVerb.ASSERT_THAT.getDefault()}: 2",
|
||||
"${TO_BE.getDefault()}: 1"
|
||||
@@ -75,7 +75,7 @@ class SmokeTest {
|
||||
expect(2).toEqual(1)
|
||||
}
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"${AssertionVerb.EXPECT.getDefault()}: 1",
|
||||
"${AssertionVerb.EXPECT.getDefault()}: 2",
|
||||
"${TO_BE.getDefault()}: 1"
|
||||
@@ -95,7 +95,7 @@ class SmokeTest {
|
||||
expect {
|
||||
throw IllegalArgumentException("oho... hello btw")
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
messageContains("hello")
|
||||
messageToContain("hello")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class SmokeTest {
|
||||
expect {
|
||||
throw IllegalArgumentException("oho... hello btw")
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
it messageContains "hello"
|
||||
it messageToContain "hello"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.reporting
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.infix.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.infix.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import org.spekframework.spek2.Spek
|
||||
@@ -12,7 +12,7 @@ class TextSpec : Spek({
|
||||
expect{
|
||||
Text("")
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
messageContains("use Text.Empty instead")
|
||||
messageToContain("use Text.Empty instead")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class TranslatableWithArgsSpec : Spek({
|
||||
expect {
|
||||
TranslatableWithArgs(HELLO, listOf())
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
its messageContains values(
|
||||
its messageToContain values(
|
||||
"No arguments specified"
|
||||
)
|
||||
}
|
||||
@@ -22,7 +22,7 @@ class TranslatableWithArgsSpec : Spek({
|
||||
expect {
|
||||
TranslatableWithArgs(HELLO, "one")
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
its messageContains values(
|
||||
its messageToContain values(
|
||||
"The number of given arguments does not match the number of placeholders in",
|
||||
"number of arguments = 1",
|
||||
"placeholders = 0"
|
||||
@@ -35,7 +35,7 @@ class TranslatableWithArgsSpec : Spek({
|
||||
expect {
|
||||
TranslatableWithArgs(WITH_1_ARG, listOf())
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
its messageContains values(
|
||||
its messageToContain values(
|
||||
"No arguments specified"
|
||||
)
|
||||
}
|
||||
@@ -48,7 +48,7 @@ class TranslatableWithArgsSpec : Spek({
|
||||
expect {
|
||||
TranslatableWithArgs(WITH_1_ARG, "one", "two")
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
its messageContains values(
|
||||
its messageToContain values(
|
||||
"The number of given arguments does not match the number of placeholders in",
|
||||
"number of arguments = 2",
|
||||
"placeholders = 1"
|
||||
@@ -61,7 +61,7 @@ class TranslatableWithArgsSpec : Spek({
|
||||
expect {
|
||||
TranslatableWithArgs(WITH_2_ARGS, listOf())
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
its messageContains values(
|
||||
its messageToContain values(
|
||||
"No arguments specified"
|
||||
)
|
||||
}
|
||||
@@ -70,7 +70,7 @@ class TranslatableWithArgsSpec : Spek({
|
||||
expect {
|
||||
TranslatableWithArgs(WITH_2_ARGS, "one")
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
its messageContains values(
|
||||
its messageToContain values(
|
||||
"The number of given arguments does not match the number of placeholders in",
|
||||
"number of arguments = 1",
|
||||
"placeholders = 2"
|
||||
|
||||
@@ -2,7 +2,10 @@ package ch.tutteli.atrium.core.polyfills
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.*
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.assertions.*
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.assertions.AssertionGroup
|
||||
import ch.tutteli.atrium.assertions.AssertionGroupType
|
||||
import ch.tutteli.atrium.assertions.RootAssertionGroupType
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.reporting.translating.Translatable
|
||||
import kotlin.reflect.KClass
|
||||
@@ -85,14 +88,14 @@ class KClassCastTest {
|
||||
fun illegalCasts_privateAndClass_throwsClassCastException() {
|
||||
expect {
|
||||
Int::class.cast(null)
|
||||
}.toThrow<ClassCastException> { this messageContains values("null", "Int") }
|
||||
}.toThrow<ClassCastException> { this messageToContain values("null", "Int") }
|
||||
expect {
|
||||
Int::class.cast(1L)
|
||||
}.toThrow<ClassCastException> { this messageContains values("Int", "Long") }
|
||||
}.toThrow<ClassCastException> { this messageToContain values("Int", "Long") }
|
||||
expect {
|
||||
Translatable::class.cast(objInterface)
|
||||
}.toThrow<ClassCastException> {
|
||||
this messageContains values(
|
||||
this messageToContain values(
|
||||
"`object: ${Assertion::class.fullName}` (js: objInterface",
|
||||
Translatable::class.fullName
|
||||
)
|
||||
@@ -100,7 +103,7 @@ class KClassCastTest {
|
||||
expect {
|
||||
Translatable::class.cast(objClass)
|
||||
}.toThrow<ClassCastException> {
|
||||
this messageContains values(
|
||||
this messageToContain values(
|
||||
"`object: ${ch.tutteli.atrium.assertions.EmptyNameAndRepresentationAssertionGroup::class.fullName}` (js: objClass",
|
||||
Translatable::class.fullName
|
||||
)
|
||||
@@ -123,11 +126,11 @@ class KClassCastTest {
|
||||
expect {
|
||||
val f1: (Int) -> Int = { it }
|
||||
f1::class.cast({ "a" })
|
||||
}.toThrow<ClassCastException> { this messageContains values(" Function0", " Function1") }
|
||||
}.toThrow<ClassCastException> { this messageToContain values(" Function0", " Function1") }
|
||||
|
||||
expect {
|
||||
type<(Int) -> Int>().cast({ "a" })
|
||||
}.toThrow<ClassCastException> { this messageContains values(" Function0", " Function1") }
|
||||
}.toThrow<ClassCastException> { this messageToContain values(" Function0", " Function1") }
|
||||
}
|
||||
|
||||
private fun Expect<String>.castAndStaysSame(): (Pair<Any, KClass<*>>) -> Unit {
|
||||
|
||||
@@ -29,7 +29,7 @@ object EitherSpec : Spek({
|
||||
expect {
|
||||
expect(either).isRight { toBeLessThan(2) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"value of Right: ❗❗ is not a Right",
|
||||
"${DescriptionComparableAssertion.IS_LESS_THAN.getDefault()}: 2"
|
||||
)
|
||||
@@ -44,7 +44,7 @@ object EitherSpec : Spek({
|
||||
expect {
|
||||
expect(either).isLeft { toStartWith("h") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"value of Left: ❗❗ is not a Left",
|
||||
"${DescriptionCharSequenceAssertion.STARTS_WITH.getDefault()}: \"h\""
|
||||
)
|
||||
|
||||
@@ -103,7 +103,7 @@ object NullableSpec : Spek({
|
||||
it("throws if the value was actually null") {
|
||||
expect {
|
||||
expect(nullableKeyMap(testee.numbersWithString)).getExisting(1).toEqual("a")
|
||||
}.toThrow<AssertionError> { messageContains("get(1): null", "equals: \"a\"") }
|
||||
}.toThrow<AssertionError> { messageToContain("get(1): null", "equals: \"a\"") }
|
||||
}
|
||||
it("can pass `null` as key") {
|
||||
expect(nullableKeyMap(testee.numbersWithString)[null]).toEqual("tada")
|
||||
@@ -122,7 +122,7 @@ object NullableSpec : Spek({
|
||||
expect {
|
||||
expect(nullableValueMap(testee.numbersWithString)).getExisting(1).toEqual("test")
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"get(1): null",
|
||||
"$toBeDescr: \"test\""
|
||||
)
|
||||
@@ -142,7 +142,7 @@ object NullableSpec : Spek({
|
||||
expect {
|
||||
expect(nullableKeyValueMap(testee.numbersWithString)).getExisting(1).toEqual("hello")
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"get(1): null",
|
||||
"$toBeDescr: \"hello\""
|
||||
)
|
||||
|
||||
@@ -148,19 +148,19 @@ abstract class AnyExpectationsSpec(
|
||||
it("${notToEqual.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.notToEqualFun(1)
|
||||
}.toThrow<AssertionError> { messageContains(NOT_TO_BE.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(NOT_TO_BE.getDefault()) }
|
||||
}
|
||||
it("${notToBeTheInstance.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.notToBeTheInstanceFun(1)
|
||||
}.toThrow<AssertionError> { messageContains(IS_NOT_SAME.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(IS_NOT_SAME.getDefault()) }
|
||||
}
|
||||
}
|
||||
context("one does not equal the other") {
|
||||
it("${toEqual.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.toEqualFun(2)
|
||||
}.toThrow<AssertionError> { messageContains(TO_BE.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(TO_BE.getDefault()) }
|
||||
}
|
||||
it("${notToEqual.name} does not throw") {
|
||||
expectSubject.notToEqualFun(2)
|
||||
@@ -168,7 +168,7 @@ abstract class AnyExpectationsSpec(
|
||||
it("${toBeTheInstance.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.toBeTheInstanceFun(2)
|
||||
}.toThrow<AssertionError> { messageContains(IS_SAME.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(IS_SAME.getDefault()) }
|
||||
}
|
||||
it("${notToBeTheInstance.name} does not throw") {
|
||||
expectSubject.notToBeTheInstanceFun(2)
|
||||
@@ -249,12 +249,12 @@ abstract class AnyExpectationsSpec(
|
||||
it("${notToEqualOneOf.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.notToEqualOneOfFun(test, emptyArray())
|
||||
}.toThrow<AssertionError> { messageContains(IS_NONE_OF.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(IS_NONE_OF.getDefault()) }
|
||||
}
|
||||
it("${notToEqualOneIn.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.notToEqualOneInFun(listOf(test))
|
||||
}.toThrow<AssertionError> { messageContains(IS_NONE_OF.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(IS_NONE_OF.getDefault()) }
|
||||
}
|
||||
}
|
||||
context("not same but one equals the other") {
|
||||
@@ -278,12 +278,12 @@ abstract class AnyExpectationsSpec(
|
||||
it("${notToEqualOneOf.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.notToEqualOneOfFun(other, emptyArray())
|
||||
}.toThrow<AssertionError> { messageContains(IS_NONE_OF.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(IS_NONE_OF.getDefault()) }
|
||||
}
|
||||
it("${notToEqualOneIn.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.notToEqualOneInFun(listOf(other))
|
||||
}.toThrow<AssertionError> { messageContains(IS_NONE_OF.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(IS_NONE_OF.getDefault()) }
|
||||
}
|
||||
}
|
||||
context("one does not equal the other") {
|
||||
@@ -345,22 +345,22 @@ abstract class AnyExpectationsSpec(
|
||||
it("${notToEqual.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.notToEqualFun(null)
|
||||
}.toThrow<AssertionError> { messageContains(NOT_TO_BE.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(NOT_TO_BE.getDefault()) }
|
||||
}
|
||||
it("${notToBeTheInstance.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.notToBeTheInstanceFun(null)
|
||||
}.toThrow<AssertionError> { messageContains(IS_NOT_SAME.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(IS_NOT_SAME.getDefault()) }
|
||||
}
|
||||
it("${notToEqualOneOf.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.notToEqualOneOfFun(null, emptyArray)
|
||||
}.toThrow<AssertionError> { messageContains(IS_NONE_OF.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(IS_NONE_OF.getDefault()) }
|
||||
}
|
||||
it("${notToEqualOneIn.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.notToEqualOneInFun(listOf(null))
|
||||
}.toThrow<AssertionError> { messageContains(IS_NONE_OF.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(IS_NONE_OF.getDefault()) }
|
||||
}
|
||||
}
|
||||
context("one does not equal the other") {
|
||||
@@ -368,7 +368,7 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect(null as T?).toEqualFun(value)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(TO_BE.getDefault())
|
||||
messageToContain(TO_BE.getDefault())
|
||||
}
|
||||
}
|
||||
it("${notToEqual.name} does not throw") {
|
||||
@@ -377,7 +377,7 @@ abstract class AnyExpectationsSpec(
|
||||
it("${toBeTheInstance.name} throws AssertionError") {
|
||||
expect {
|
||||
expectSubject.toBeTheInstanceFun(value)
|
||||
}.toThrow<AssertionError> { messageContains(IS_SAME.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(IS_SAME.getDefault()) }
|
||||
}
|
||||
it("${notToBeTheInstance.name} does not throw") {
|
||||
expectSubject.notToBeTheInstanceFun(value)
|
||||
@@ -489,13 +489,13 @@ abstract class AnyExpectationsSpec(
|
||||
}
|
||||
context("throws an AssertionError and exception message") {
|
||||
it("contains the subject") {
|
||||
expectFun.toThrow<AssertionError> { messageContains(subject.toString()) }
|
||||
expectFun.toThrow<AssertionError> { messageToContain(subject.toString()) }
|
||||
}
|
||||
it("contains the '${DescriptiveAssertion::description.name}' of the assertion-message - which should be '${TO_BE.getDefault()}'") {
|
||||
expectFun.toThrow<AssertionError> { messageContains(TO_BE.getDefault()) }
|
||||
expectFun.toThrow<AssertionError> { messageToContain(TO_BE.getDefault()) }
|
||||
}
|
||||
it("contains the '${DescriptiveAssertion::representation.name}' of the assertion-message") {
|
||||
expectFun.toThrow<AssertionError> { messageContains(Text.NULL.string) }
|
||||
expectFun.toThrow<AssertionError> { messageToContain(Text.NULL.string) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -513,7 +513,7 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect(subject).toEqualFun(1)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(": null", "${TO_BE.getDefault()}: 1")
|
||||
messageToContain(": null", "${TO_BE.getDefault()}: 1")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -527,14 +527,14 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect(subject).toEqualFun(null)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(": 1", "${TO_BE.getDefault()}: null")
|
||||
messageToContain(": 1", "${TO_BE.getDefault()}: null")
|
||||
}
|
||||
}
|
||||
it("throws an AssertionError if expected does not equal subject") {
|
||||
expect {
|
||||
expect(subject).toEqualFun(2)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(": 1", "${TO_BE.getDefault()}: 2")
|
||||
messageToContain(": 1", "${TO_BE.getDefault()}: 2")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -551,7 +551,7 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect(subject).toBeNullIfNullElseFun { toEqual(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(": null", "${TO_BE.getDefault()}: 1")
|
||||
messageToContain(": null", "${TO_BE.getDefault()}: 1")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -565,14 +565,14 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect(subject).toBeNullIfNullElseFun { toBeGreaterThan(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(": 1", "${IS_GREATER_THAN.getDefault()}: 1")
|
||||
messageToContain(": 1", "${IS_GREATER_THAN.getDefault()}: 1")
|
||||
}
|
||||
}
|
||||
it("throws an AssertionError if null is passed") {
|
||||
expect {
|
||||
expect(subject).toBeNullIfNullElseFun(null)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(": 1", "${TO_BE.getDefault()}: null")
|
||||
messageToContain(": 1", "${TO_BE.getDefault()}: null")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -588,8 +588,8 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect(null as Int?).notToBeNullFun { toEqual(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(IS_A.getDefault() + ": Int (kotlin.Int)")
|
||||
if (hasExtraHint) messageContains("$toBeDescr: 1")
|
||||
messageToContain(IS_A.getDefault() + ": Int (kotlin.Int)")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: 1")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -609,7 +609,7 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect(1 as Int?).notToBeNullFun { toBeLessThan(0) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("${IS_LESS_THAN.getDefault()}: 0")
|
||||
messageToContain("${IS_LESS_THAN.getDefault()}: 0")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -637,8 +637,8 @@ abstract class AnyExpectationsSpec(
|
||||
val i: Int? = 1
|
||||
expect(i).notToBeNullFun { toBeGreaterThan(2); toBeLessThan(0) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(IS_GREATER_THAN.getDefault())
|
||||
if (hasExtraHint) messageContains(IS_LESS_THAN.getDefault())
|
||||
messageToContain(IS_GREATER_THAN.getDefault())
|
||||
if (hasExtraHint) messageToContain(IS_LESS_THAN.getDefault())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -652,11 +652,11 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect(A()).feature(A::i).notToBeNullFun { toEqual(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
A::class.simpleName!!,
|
||||
IS_A.getDefault() + ": Int (kotlin.Int)"
|
||||
)
|
||||
if (hasExtraHint) messageContains(TO_BE.getDefault() + ": 1")
|
||||
if (hasExtraHint) messageToContain(TO_BE.getDefault() + ": 1")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -665,11 +665,10 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect(A()).feature(A::i).notToEqualNull { toBeLessThan(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
A::class.simpleName!!,
|
||||
IS_A.getDefault() + ": Int (kotlin.Int)",
|
||||
IS_LESS_THAN.getDefault()
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -686,8 +685,8 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect("hello" as Any?).toBeAnInstanceOfInt { toEqual(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(IS_A.getDefault() + ": Int (kotlin.Int)")
|
||||
if (hasExtraHint) messageContains(TO_BE.getDefault() + ": 1")
|
||||
messageToContain(IS_A.getDefault() + ": Int (kotlin.Int)")
|
||||
if (hasExtraHint) messageToContain(TO_BE.getDefault() + ": 1")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -707,7 +706,7 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect(actualValue).toBeAnInstanceOfInt { toBeLessThan(expectedLessThan) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(actualValue as Any, IS_LESS_THAN.getDefault(), expectedLessThan)
|
||||
messageToContain(actualValue as Any, IS_LESS_THAN.getDefault(), expectedLessThan)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -730,7 +729,7 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect(subject as Any?).toBeAnInstanceOfSuperType { toBeTheInstance(otherSubType) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(subject.toString(), IS_SAME.getDefault(), otherSubType.toString())
|
||||
messageToContain(subject.toString(), IS_SAME.getDefault(), otherSubType.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -745,11 +744,11 @@ abstract class AnyExpectationsSpec(
|
||||
expect {
|
||||
expect(SuperType() as Any?).toBeAnInstanceOfSubType { toBeTheInstance(SubType()) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
SuperType::class.fullName,
|
||||
IS_A.getDefault(), SubType::class.fullName
|
||||
)
|
||||
if (hasExtraHint) messageContains(IS_SAME.getDefault())
|
||||
if (hasExtraHint) messageToContain(IS_SAME.getDefault())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,13 +117,13 @@ abstract class CharSequenceExpectationsSpec(
|
||||
it("${startsNotWith.name} 'Hello' throws an AssertionError") {
|
||||
expect {
|
||||
fluent.startsNotWithFun("Hello")
|
||||
}.toThrow<AssertionError> { messageContains(STARTS_NOT_WITH.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(STARTS_NOT_WITH.getDefault()) }
|
||||
}
|
||||
|
||||
it("${startsWith.name} 'Robert' throws an AssertionError") {
|
||||
expect {
|
||||
fluent.startsWithFun("goodbye")
|
||||
}.toThrow<AssertionError> { messageContains(STARTS_WITH.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(STARTS_WITH.getDefault()) }
|
||||
}
|
||||
it("${startsNotWith.name} 'Robert' does not throw") {
|
||||
fluent.startsNotWithFun("goodbye")
|
||||
@@ -139,7 +139,7 @@ abstract class CharSequenceExpectationsSpec(
|
||||
it("${endsWith.name} 'Hello' throws an AssertionError") {
|
||||
expect {
|
||||
fluent.endsWithFun("Hello")
|
||||
}.toThrow<AssertionError> { messageContains(ENDS_WITH.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(ENDS_WITH.getDefault()) }
|
||||
}
|
||||
it("${endsNotWith.name} 'Hello' does not throw") {
|
||||
fluent.endsNotWithFun("Hello")
|
||||
@@ -151,7 +151,7 @@ abstract class CharSequenceExpectationsSpec(
|
||||
it("${endsNotWith.name} 'Robert' throws an AssertionError") {
|
||||
expect {
|
||||
fluent.endsNotWithFun("Robert")
|
||||
}.toThrow<AssertionError> { messageContains(ENDS_NOT_WITH.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(ENDS_NOT_WITH.getDefault()) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ abstract class CharSequenceExpectationsSpec(
|
||||
it("${matches.name} 'Hello' throws an AssertionError") {
|
||||
expect {
|
||||
fluent.matchesFun(Regex("Hello"))
|
||||
}.toThrow<AssertionError> { messageContains(MATCHES.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(MATCHES.getDefault()) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,7 +183,7 @@ abstract class CharSequenceExpectationsSpec(
|
||||
it("${mismatches.name} 'Hello my name is Robert' throws an AssertionError"){
|
||||
expect {
|
||||
fluent.mismatchesFun(Regex("Hello my name is Robert"))
|
||||
}.toThrow<AssertionError> { messageContains(MISMATCHES.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(MISMATCHES.getDefault()) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
@@ -47,22 +47,22 @@ abstract class CharSequenceNotToContainExpectationsSpec(
|
||||
it("if an object is passed as first expected") {
|
||||
expect {
|
||||
fluent.notToContainFun(fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
it("if an object is passed as second expected") {
|
||||
expect {
|
||||
fluent.notToContainFun("that's fine", fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
it("if an object is passed as first expected") {
|
||||
expect {
|
||||
fluent.notToContainIgnoringCaseFun(fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
it("if an object is passed as second expected") {
|
||||
expect {
|
||||
fluent.notToContainIgnoringCaseFun("that's fine", fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ abstract class CharSequenceNotToContainExpectationsSpec(
|
||||
expect {
|
||||
fluentHelloWorld.notToContainFun('l')
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$rootBulletPoint$notToContainDescr: $separator" +
|
||||
"$valueWithIndent: 'l'",
|
||||
"$numberOfOccurrences: 3",
|
||||
@@ -98,18 +98,18 @@ abstract class CharSequenceNotToContainExpectationsSpec(
|
||||
it("${notToContainPair.first("'H', 'l'")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.notToContainFun('H', 'l')
|
||||
}.toThrow<AssertionError> { messageContains("$valueWithIndent: 'l'") }
|
||||
}.toThrow<AssertionError> { messageToContain("$valueWithIndent: 'l'") }
|
||||
}
|
||||
it("${notToContainPair.first("'l', 'H'")} once throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.notToContainFun('l', 'H')
|
||||
}.toThrow<AssertionError> { messageContains("$valueWithIndent: 'l'") }
|
||||
}.toThrow<AssertionError> { messageToContain("$valueWithIndent: 'l'") }
|
||||
}
|
||||
it("${notToContainIgnoringCasePair.first("'H', 'l'")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.notToContainIgnoringCaseFun('H', 'l')
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$rootBulletPoint$notToContainIgnoringCaseDescr: $separator" +
|
||||
"$valueWithIndent: 'H'",
|
||||
"$valueWithIndent: 'l'"
|
||||
@@ -119,17 +119,17 @@ abstract class CharSequenceNotToContainExpectationsSpec(
|
||||
it("${notToContainIgnoringCasePair.first("'L', 'H'")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.notToContainIgnoringCaseFun('L', 'H')
|
||||
}.toThrow<AssertionError> { messageContains('H', 'L') }
|
||||
}.toThrow<AssertionError> { messageToContain('H', 'L') }
|
||||
}
|
||||
it("${notToContainPair.first("'o', 'E', 'w', 'l'")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.notToContainFun('o', 'E', 'w', 'l')
|
||||
}.toThrow<AssertionError> { messageContains('o', 'l') }
|
||||
}.toThrow<AssertionError> { messageToContain('o', 'l') }
|
||||
}
|
||||
it("${notToContainIgnoringCasePair.first("'o', 'E', 'w', 'l'")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.notToContainIgnoringCaseFun('o', 'E', 'w', 'l')
|
||||
}.toThrow<AssertionError> { messageContains('o', 'E', "w", 'l') }
|
||||
}.toThrow<AssertionError> { messageToContain('o', 'E', "w", 'l') }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract class CharSequenceNotToContainOrAtMostExpectationsSpec(
|
||||
it("for not at all or at most -1 -- only positive numbers") {
|
||||
expect {
|
||||
fluent.notToContainOrAtMostFun(-1, "")
|
||||
}.toThrow<IllegalArgumentException> { messageContains("positive number", -1) }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("positive number", -1) }
|
||||
}
|
||||
it("for not at all or at most 0 -- points to $notToContain") {
|
||||
expect {
|
||||
@@ -55,12 +55,12 @@ abstract class CharSequenceNotToContainOrAtMostExpectationsSpec(
|
||||
it("if an object is passed as first expected") {
|
||||
expect {
|
||||
fluent.notToContainOrAtMostFun(1, fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
it("if an object is passed as second expected") {
|
||||
expect {
|
||||
fluent.notToContainOrAtMostFun(1, "that's fine", fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ abstract class CharSequenceNotToContainOrAtMostExpectationsSpec(
|
||||
it("${notToContainOrAtMostPair.first("'l'", "once")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.notToContainOrAtMostFun(1, 'l')
|
||||
}.toThrow<AssertionError> { messageContains("$atMost: 1", "$valueWithIndent: 'l'") }
|
||||
}.toThrow<AssertionError> { messageToContain("$atMost: 1", "$valueWithIndent: 'l'") }
|
||||
}
|
||||
it("${notToContainOrAtMostPair.first("'H', 'l'", "once")} throws AssertionError mentioning only 'l'") {
|
||||
expect {
|
||||
@@ -151,7 +151,7 @@ abstract class CharSequenceNotToContainOrAtMostExpectationsSpec(
|
||||
it("${notToContainOrAtMostIgnoringCasePair.first("'o'", "twice")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.notToContainOrAtMostIgnoringCaseFun(2, 'o')
|
||||
}.toThrow<AssertionError> { messageContains(AT_MOST.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(AT_MOST.getDefault()) }
|
||||
}
|
||||
|
||||
it("${notToContainOrAtMostPair.first("'o'", "3 times")} does not throw") {
|
||||
|
||||
@@ -61,7 +61,7 @@ abstract class CharSequenceToContainAtLeastExpectationsSpec(
|
||||
it("for at least -1 -- only positive numbers") {
|
||||
expect {
|
||||
fluent.toContainAtLeastFun(-1, "")
|
||||
}.toThrow<IllegalArgumentException> { messageContains("positive number", -1) }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("positive number", -1) }
|
||||
}
|
||||
it("for at least 0 -- points to $notToContain") {
|
||||
expect {
|
||||
@@ -71,12 +71,12 @@ abstract class CharSequenceToContainAtLeastExpectationsSpec(
|
||||
it("if an object is passed as first expected") {
|
||||
expect {
|
||||
fluent.toContainAtLeastFun(1, fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
it("if an object is passed as second expected") {
|
||||
expect {
|
||||
fluent.toContainAtLeastFun(1, "that's fine", fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
|
||||
context("using $toContainAtLeastButAtMost") {
|
||||
@@ -103,24 +103,24 @@ abstract class CharSequenceToContainAtLeastExpectationsSpec(
|
||||
it("if an object is passed as first expected") {
|
||||
expect {
|
||||
fluent.toContainAtLeastButAtMostFun(1, 2, fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
it("if an object is passed as second expected") {
|
||||
expect {
|
||||
fluent.toContainAtLeastButAtMostFun(1, 2, "that's fine", fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
}
|
||||
|
||||
it("searching for an empty String - warns the user that the assertion is useless") {
|
||||
expect {
|
||||
fluent.toContainAtLeastFun(1, "that's fine", "" /* <- that's not */)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("empty string", "forgot") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("empty string", "forgot") }
|
||||
}
|
||||
it("searching for an empty CharSequence - warns the user that the assertion is useless") {
|
||||
expect {
|
||||
fluent.toContainAtLeastFun(1, "that's fine", StringBuilder() /* <- that's not */)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("empty CharSequence", "forgot") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("empty CharSequence", "forgot") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ abstract class CharSequenceToContainAtLeastExpectationsSpec(
|
||||
it("${toContainAtLeastPair.first("'h'", "once")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.toContainAtLeastFun(1, 'h')
|
||||
}.toThrow<AssertionError> { messageContains("$atLeast: 1", "$valueWithIndent: 'h'") }
|
||||
}.toThrow<AssertionError> { messageToContain("$atLeast: 1", "$valueWithIndent: 'h'") }
|
||||
}
|
||||
it("${toContainAtLeastIgnoringCasePair.first("'h'", "once")} does not throw") {
|
||||
fluentHelloWorld.toContainAtLeastIgnoringCaseFun(1, 'h')
|
||||
@@ -151,7 +151,7 @@ abstract class CharSequenceToContainAtLeastExpectationsSpec(
|
||||
it("${toContainAtLeastPair.first("'H', 'E'", "once")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.toContainAtLeastFun(1, 'H', 'E')
|
||||
}.toThrow<AssertionError> { messageContains(atLeast, 'E') }
|
||||
}.toThrow<AssertionError> { messageToContain(atLeast, 'E') }
|
||||
}
|
||||
it("${toContainAtLeastIgnoringCasePair.first("'H', 'E'", "once")} does not throw") {
|
||||
fluentHelloWorld.toContainAtLeastIgnoringCaseFun(1, 'H', 'E')
|
||||
@@ -322,7 +322,7 @@ abstract class CharSequenceToContainAtLeastExpectationsSpec(
|
||||
it("${toContainAtLeastPair.first("'a'", "5 times")} throws AssertionError") {
|
||||
expect {
|
||||
aaaaFluent.toContainAtLeastFun(5, 'a')
|
||||
}.toThrow<AssertionError> { messageContains("$atLeast: 5", "$valueWithIndent: 'a'") }
|
||||
}.toThrow<AssertionError> { messageToContain("$atLeast: 5", "$valueWithIndent: 'a'") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ abstract class CharSequenceToContainAtMostExpectationsSpec(
|
||||
it("for at most -1 -- only positive numbers") {
|
||||
expect {
|
||||
fluent.toContainAtMostFun(-1, "")
|
||||
}.toThrow<IllegalArgumentException> { messageContains("positive number", -1) }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("positive number", -1) }
|
||||
}
|
||||
it("for at most 0 -- points to $notToContain") {
|
||||
expect {
|
||||
@@ -61,12 +61,12 @@ abstract class CharSequenceToContainAtMostExpectationsSpec(
|
||||
it("if an object is passed as first expected") {
|
||||
expect {
|
||||
fluent.toContainAtMostFun(2, fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
it("if an object is passed as second expected") {
|
||||
expect {
|
||||
fluent.toContainAtMostFun(2, "that's fine", fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ abstract class CharSequenceToContainAtMostExpectationsSpec(
|
||||
it("${toContainAtMostPair.first("'l'", "twice")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.toContainAtMostFun(2, 'l')
|
||||
}.toThrow<AssertionError> { messageContains("$atMost: 2", "$valueWithIndent: 'l'") }
|
||||
}.toThrow<AssertionError> { messageToContain("$atMost: 2", "$valueWithIndent: 'l'") }
|
||||
}
|
||||
it("${toContainAtMostPair.first("'H', 'l'", "twice")} throws AssertionError mentioning only 'l'") {
|
||||
expect {
|
||||
|
||||
@@ -46,7 +46,7 @@ abstract class CharSequenceToContainExactlyExpectationsSpec(
|
||||
it("for exactly -1 -- only positive numbers") {
|
||||
expect {
|
||||
fluent.toContainExactlyFun(-1, "")
|
||||
}.toThrow<IllegalArgumentException> { messageContains("positive number", -1) }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("positive number", -1) }
|
||||
}
|
||||
it("for exactly 0 -- points to $notToContain") {
|
||||
expect {
|
||||
@@ -56,12 +56,12 @@ abstract class CharSequenceToContainExactlyExpectationsSpec(
|
||||
it("if an object is passed as first expected") {
|
||||
expect {
|
||||
fluent.toContainExactlyFun(1, fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
it("if an object is passed as second expected") {
|
||||
expect {
|
||||
fluent.toContainExactlyFun(1, "that's fine", fluent)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("CharSequence", "Number", "Char") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("CharSequence", "Number", "Char") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ abstract class CharSequenceToContainExactlyExpectationsSpec(
|
||||
it("${toContainExactlyPair.first("'h'", "once")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.toContainExactlyFun(1, 'h')
|
||||
}.toThrow<AssertionError> { messageContains("$exactly: 1", "$valueWithIndent: 'h'") }
|
||||
}.toThrow<AssertionError> { messageToContain("$exactly: 1", "$valueWithIndent: 'h'") }
|
||||
}
|
||||
it("${toContainExactlyIgnoringCasePair.first("'h'", "once")} throws AssertionError") {
|
||||
fluentHelloWorld.toContainExactlyIgnoringCaseFun(1, 'h')
|
||||
@@ -125,7 +125,7 @@ abstract class CharSequenceToContainExactlyExpectationsSpec(
|
||||
it("${toContainExactlyPair.first("'H' and 'E' and 'w'", "once")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.toContainExactlyFun(1, 'H', 'E', 'w')
|
||||
}.toThrow<AssertionError> { messageContains(exactly, 'E', 'w') }
|
||||
}.toThrow<AssertionError> { messageToContain(exactly, 'E', 'w') }
|
||||
}
|
||||
it("${toContainExactlyIgnoringCasePair.first("'H' and 'E' and 'w'", "once")} throws AssertionError") {
|
||||
fluentHelloWorld.toContainExactlyIgnoringCaseFun(1, 'H', 'E', 'w')
|
||||
@@ -136,7 +136,7 @@ abstract class CharSequenceToContainExactlyExpectationsSpec(
|
||||
it("${toContainExactlyPair.first("'o'", "once")} throws AssertionError") {
|
||||
expect {
|
||||
fluentHelloWorld.toContainExactlyFun(1, 'o')
|
||||
}.toThrow<AssertionError> { messageContains("$exactly: 1", "$valueWithIndent: 'o'") }
|
||||
}.toThrow<AssertionError> { messageToContain("$exactly: 1", "$valueWithIndent: 'o'") }
|
||||
}
|
||||
it("${toContainExactlyPair.first("'o'", "twice")} does not throw") {
|
||||
fluentHelloWorld.toContainExactlyFun(2, 'o')
|
||||
|
||||
@@ -39,7 +39,7 @@ abstract class CharSequenceToContainNotToContainExpectationsSpec(
|
||||
expect {
|
||||
fluentEmptyString.toContainFun("Hello")
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$rootBulletPoint$toContainDescr: $separator" +
|
||||
"$valueWithIndent: \"Hello\"",
|
||||
"$numberOfOccurrences: 0",
|
||||
@@ -61,7 +61,7 @@ abstract class CharSequenceToContainNotToContainExpectationsSpec(
|
||||
it("${notToContain.name} 'Hello' throws AssertionError") {
|
||||
expect {
|
||||
fluent.notToContainFun("Hello")
|
||||
}.toThrow<AssertionError> { messageContains(notToContainDescr, "$valueWithIndent: \"Hello\"") }
|
||||
}.toThrow<AssertionError> { messageToContain(notToContainDescr, "$valueWithIndent: \"Hello\"") }
|
||||
}
|
||||
|
||||
it("${toContain.name} 'Hello' and 'Robert' does not throw") {
|
||||
@@ -71,7 +71,11 @@ abstract class CharSequenceToContainNotToContainExpectationsSpec(
|
||||
expect {
|
||||
fluent.notToContainFun("Hello", "Robert")
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(notToContainDescr, "$valueWithIndent: \"Hello\"", "$valueWithIndent: \"Robert\"")
|
||||
messageToContain(
|
||||
notToContainDescr,
|
||||
"$valueWithIndent: \"Hello\"",
|
||||
"$valueWithIndent: \"Robert\""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,7 +85,7 @@ abstract class CharSequenceToContainNotToContainExpectationsSpec(
|
||||
expect {
|
||||
fluent.toContainFun("notInThere", "neitherInThere")
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
toContainDescr,
|
||||
"$valueWithIndent: \"notInThere\"",
|
||||
"$valueWithIndent: \"neitherInThere\""
|
||||
@@ -120,7 +124,7 @@ abstract class CharSequenceToContainNotToContainExpectationsSpec(
|
||||
it("${toContain.name} 'notInThere' throws AssertionError") {
|
||||
expect {
|
||||
fluent.toContainFun("notInThere")
|
||||
}.toThrow<AssertionError> { messageContains(toContainDescr, "$valueWithIndent: \"notInThere\"") }
|
||||
}.toThrow<AssertionError> { messageToContain(toContainDescr, "$valueWithIndent: \"notInThere\"") }
|
||||
}
|
||||
it("${notToContain.name} 'notInThere' does not throw") {
|
||||
fluent.notToContainFun("notInThere")
|
||||
|
||||
@@ -50,7 +50,7 @@ abstract class CollectionExpectationsSpec(
|
||||
it("${isNotEmpty.name} - throws an AssertionError") {
|
||||
expect {
|
||||
expect(listOf<Int>() as Collection<Int>).isNotEmptyFun()
|
||||
}.toThrow<AssertionError> { messageContains("$isNotDescr: $empty") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isNotDescr: $empty") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ abstract class CollectionExpectationsSpec(
|
||||
it("${isEmpty.name} - throws an AssertionError") {
|
||||
expect {
|
||||
expect(listOf(1, 2) as Collection<Int>).isEmptyFun()
|
||||
}.toThrow<AssertionError> { messageContains("$isDescr: $empty") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isDescr: $empty") }
|
||||
}
|
||||
it("${isNotEmpty.name} - does not throw") {
|
||||
expect(listOf(1) as Collection<Int>).isNotEmptyFun()
|
||||
@@ -78,7 +78,7 @@ abstract class CollectionExpectationsSpec(
|
||||
expect {
|
||||
fluent.sizeFun { toBeLessThan(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$sizeDescr: 2")
|
||||
messageToContain("$sizeDescr: 2")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.specs.*
|
||||
@@ -51,12 +51,12 @@ abstract class ComparableExpectationsSpec(
|
||||
it("... 10 throws an AssertionError containing ${DescriptionComparableAssertion::class.simpleName}.$IS_LESS_THAN and `: 10`") {
|
||||
expect {
|
||||
fluent.toBeLessThanFun(10)
|
||||
}.toThrow<AssertionError> { messageContains("$toBeLessThanDescr: 10") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeLessThanDescr: 10") }
|
||||
}
|
||||
it("... 9 throws an AssertionError containing ${DescriptionComparableAssertion::class.simpleName}.$IS_LESS_THAN and `: 10`") {
|
||||
expect {
|
||||
fluent.toBeLessThanFun(9)
|
||||
}.toThrow<AssertionError> { messageContains("$toBeLessThanDescr: 9") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeLessThanDescr: 9") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ abstract class ComparableExpectationsSpec(
|
||||
it("... 9 throws an AssertionError containing ${DescriptionComparableAssertion::class.simpleName}.$IS_LESS_THAN_OR_EQUAL and `: 10`") {
|
||||
expect {
|
||||
fluent.toBeLessThanOrEqualToFun(9)
|
||||
}.toThrow<AssertionError> { messageContains("$toBeLessThanOrEqualToDescr: 9") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeLessThanOrEqualToDescr: 9") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ abstract class ComparableExpectationsSpec(
|
||||
it("... 11 throws an AssertionError containing ${DescriptionComparableAssertion::class.simpleName}.$IS_EQUAL and `: 11`") {
|
||||
expect {
|
||||
fluent.toBeEqualComparingToFun(11)
|
||||
}.toThrow<AssertionError> { messageContains("$toBeEqualComparingToDescr: 11") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeEqualComparingToDescr: 11") }
|
||||
}
|
||||
it("... 10 does not throw") {
|
||||
fluent.toBeEqualComparingToFun(10)
|
||||
@@ -90,7 +90,7 @@ abstract class ComparableExpectationsSpec(
|
||||
it("... 9 throws an AssertionError containing ${DescriptionComparableAssertion::class.simpleName}.$IS_EQUAL and `: 9`") {
|
||||
expect {
|
||||
fluent.toBeEqualComparingToFun(9)
|
||||
}.toThrow<AssertionError> { messageContains("$toBeEqualComparingToDescr: 9") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeEqualComparingToDescr: 9") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ abstract class ComparableExpectationsSpec(
|
||||
it("... 11 throws an AssertionError containing ${DescriptionComparableAssertion::class.simpleName}.$IS_GREATER_THAN_OR_EQUAL and `: 11`") {
|
||||
expect {
|
||||
fluent.toBeGreaterThanOrEqualFun(11)
|
||||
}.toThrow<AssertionError> { messageContains("$toBeGreaterThanOrEqualToDescr: 11") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeGreaterThanOrEqualToDescr: 11") }
|
||||
}
|
||||
it("... 10 does not throw") {
|
||||
fluent.toBeGreaterThanOrEqualFun(10)
|
||||
@@ -116,12 +116,12 @@ abstract class ComparableExpectationsSpec(
|
||||
it("... 11 throws an AssertionError containing ${DescriptionComparableAssertion::class.simpleName}.$IS_GREATER_THAN and `: 11`") {
|
||||
expect {
|
||||
fluent.toBeGreaterThanFun(11)
|
||||
}.toThrow<AssertionError> { messageContains("$toBeGreaterThanDescr: 11") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeGreaterThanDescr: 11") }
|
||||
}
|
||||
it("... 10 throws an AssertionError containing ${DescriptionComparableAssertion::class.simpleName}.$IS_GREATER_THAN and `: 10`") {
|
||||
expect {
|
||||
fluent.toBeGreaterThanFun(10)
|
||||
}.toThrow<AssertionError> { messageContains("$toBeGreaterThanDescr: 10") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeGreaterThanDescr: 10") }
|
||||
}
|
||||
it("... 9 does not throw") {
|
||||
fluent.toBeGreaterThanFun(9)
|
||||
@@ -136,13 +136,13 @@ abstract class ComparableExpectationsSpec(
|
||||
expect {
|
||||
val subject = DiffEqualsCompareTo("welcome")
|
||||
expect(subject).toBeLessThanFun(subject)
|
||||
}.toThrow<AssertionError> { messageContains("$toBeLessThanOrEqualToDescr: DiffEqualsCompareTo(s=welcome)") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeLessThanOrEqualToDescr: DiffEqualsCompareTo(s=welcome)") }
|
||||
}
|
||||
|
||||
it("expected equals but compareTo does not return 0 but 1- throws AssertionError") {
|
||||
expect {
|
||||
expect(DiffEqualsCompareTo("welcome")).toBeLessThanFun(DiffEqualsCompareTo("welcome"))
|
||||
}.toThrow<AssertionError> { messageContains("$toBeLessThanOrEqualToDescr: DiffEqualsCompareTo(s=welcome)") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeLessThanOrEqualToDescr: DiffEqualsCompareTo(s=welcome)") }
|
||||
}
|
||||
it("expected does not equal but compareTo returns 0 - does not throw") {
|
||||
expect(DiffEqualsCompareTo("welcome")).toBeLessThanFun(DiffEqualsCompareTo("hello"))
|
||||
@@ -155,13 +155,13 @@ abstract class ComparableExpectationsSpec(
|
||||
expect {
|
||||
val subject = DiffEqualsCompareTo("welcome")
|
||||
expect(subject).toBeEqualComparingToFun(subject)
|
||||
}.toThrow<AssertionError> { messageContains("$toBeEqualComparingToDescr: DiffEqualsCompareTo(s=welcome)") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeEqualComparingToDescr: DiffEqualsCompareTo(s=welcome)") }
|
||||
}
|
||||
|
||||
it("expected equals but compareTo does not return 0 but 1 - throws AssertionError") {
|
||||
expect {
|
||||
expect(DiffEqualsCompareTo("welcome")).toBeEqualComparingToFun(DiffEqualsCompareTo("welcome"))
|
||||
}.toThrow<AssertionError> { messageContains("$toBeEqualComparingToDescr: DiffEqualsCompareTo(s=welcome)") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeEqualComparingToDescr: DiffEqualsCompareTo(s=welcome)") }
|
||||
}
|
||||
it("expected does not equal but compareTo returns 0 - does not throw") {
|
||||
expect(DiffEqualsCompareTo("welcome")).toBeEqualComparingToFun(DiffEqualsCompareTo("hello"))
|
||||
@@ -174,13 +174,13 @@ abstract class ComparableExpectationsSpec(
|
||||
expect {
|
||||
val subject = DiffEqualsCompareTo("allo")
|
||||
expect(subject).toBeGreaterThanOrEqualFun(subject)
|
||||
}.toThrow<AssertionError> { messageContains("$toBeGreaterThanOrEqualToDescr: DiffEqualsCompareTo(s=allo)") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeGreaterThanOrEqualToDescr: DiffEqualsCompareTo(s=allo)") }
|
||||
}
|
||||
|
||||
it("expected equals but compareTo does not return 0 but -1 - throws AssertionError") {
|
||||
expect {
|
||||
expect(DiffEqualsCompareTo("allo")).toBeGreaterThanOrEqualFun(DiffEqualsCompareTo("allo"))
|
||||
}.toThrow<AssertionError> { messageContains("$toBeGreaterThanOrEqualToDescr: DiffEqualsCompareTo(s=allo)") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeGreaterThanOrEqualToDescr: DiffEqualsCompareTo(s=allo)") }
|
||||
}
|
||||
it("expected does not equal but compareTo returns 0 - does not throw") {
|
||||
expect(DiffEqualsCompareTo("welcome")).toBeGreaterThanOrEqualFun(DiffEqualsCompareTo("hello"))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.get
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.creating.ErrorMessages
|
||||
@@ -158,9 +158,9 @@ abstract class FeatureExpectationsSpec(
|
||||
expect {
|
||||
act(assertion)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(stringInExceptionMessage)
|
||||
messageToContain(stringInExceptionMessage)
|
||||
if (additionalContentInException != null) {
|
||||
messageContains(additionalContentInException)
|
||||
messageToContain(additionalContentInException)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,9 +180,9 @@ abstract class FeatureExpectationsSpec(
|
||||
act(assertion)
|
||||
}.toThrow<AssertionError> {
|
||||
if (isAbleToEvaluateDescription) {
|
||||
messageContains(stringInExceptionMessage)
|
||||
messageToContain(stringInExceptionMessage)
|
||||
} else {
|
||||
messageContains(ch.tutteli.atrium.translations.ErrorMessages.DESCRIPTION_BASED_ON_SUBJECT.getDefault())
|
||||
messageToContain(ch.tutteli.atrium.translations.ErrorMessages.DESCRIPTION_BASED_ON_SUBJECT.getDefault())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ abstract class FeatureExpectationsSpec(
|
||||
expect {
|
||||
expect(TestData("hello robert and some additional text", 1)).itsLazyWithNestedImmediate()
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$lazyWithNestedImmediateFeatureInfo: 37", "$toBeDescr: 12")
|
||||
messageToContain("$lazyWithNestedImmediateFeatureInfo: 37", "$toBeDescr: 12")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -242,7 +242,7 @@ abstract class FeatureExpectationsSpec(
|
||||
expect {
|
||||
expect(TestData("hello robert and some additional text", 1)).itsLazyWithNestedLazy()
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$lazyWithNestedLazyFeatureInfo: 37", "$toBeDescr: 12")
|
||||
messageToContain("$lazyWithNestedLazyFeatureInfo: 37", "$toBeDescr: 12")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,7 +264,7 @@ abstract class FeatureExpectationsSpec(
|
||||
expect {
|
||||
expect(TestData("hello robert", 1)).lambda()
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
ErrorMessages.AT_LEAST_ONE_ASSERTION_DEFINED.getDefault() + ": false",
|
||||
ErrorMessages.FORGOT_DO_DEFINE_ASSERTION.getDefault(),
|
||||
ErrorMessages.HINT_AT_LEAST_ONE_ASSERTION_DEFINED.getDefault()
|
||||
|
||||
@@ -28,7 +28,7 @@ abstract class Fun0ExpectationsSpec(
|
||||
include(object : SubjectLessSpec<() -> Any?>(
|
||||
"$describePrefix[toThrow] ",
|
||||
toThrowFeature.forSubjectLess().adjustName { "$it feature" },
|
||||
toThrow.forSubjectLess { messageContains("bla") }
|
||||
toThrow.forSubjectLess { messageToContain("bla") }
|
||||
) {})
|
||||
|
||||
include(object : SubjectLessSpec<() -> Int>(describePrefix,
|
||||
@@ -41,7 +41,7 @@ abstract class Fun0ExpectationsSpec(
|
||||
assertionCreatorSpecTriple(
|
||||
toThrow.name,
|
||||
"bla",
|
||||
{ apply { toThrow.invoke(this) { messageContains("bla") } } },
|
||||
{ apply { toThrow.invoke(this) { messageToContain("bla") } } },
|
||||
{ apply { toThrow.invoke(this) {} } }
|
||||
)
|
||||
) {})
|
||||
@@ -109,7 +109,7 @@ abstract class Fun0ExpectationsSpec(
|
||||
expect {
|
||||
expect { 123456789 }.notToThrowFun { toEqual(1) }
|
||||
}.toThrow<AssertionError>() {
|
||||
messageContains("123456789")
|
||||
messageToContain("123456789")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,7 +199,7 @@ abstract class Fun0ExpectationsSpec(
|
||||
}.toThrowFun { message.toEqual("hello") }
|
||||
}.toThrow<AssertionError> {
|
||||
expectCauseInReporting()
|
||||
if (hasExtraHint) messageContains("$toBeDescr: \"hello\"")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: \"hello\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ abstract class Fun0ExpectationsSpec(
|
||||
}.notToThrowFun { toEqual(2) }
|
||||
}.toThrow<AssertionError> {
|
||||
expectCauseInReporting()
|
||||
if (hasExtraHint) messageContains("$toBeDescr: 2")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: 2")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,7 +244,7 @@ abstract class Fun0ExpectationsSpec(
|
||||
}.toThrowFun { message.toEqual("hello") }
|
||||
}.toThrow<AssertionError> {
|
||||
expectCauseAndNestedInReporting()
|
||||
if (hasExtraHint) messageContains("$toBeDescr: \"hello\"")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: \"hello\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ abstract class Fun0ExpectationsSpec(
|
||||
}.notToThrowFun { toEqual(2) }
|
||||
}.toThrow<AssertionError> {
|
||||
expectCauseAndNestedInReporting()
|
||||
if (hasExtraHint) messageContains("$toBeDescr: 2")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: 2")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ abstract class IterableExpectationsSpec(
|
||||
it("throws an AssertionError if an iterable does not have next") {
|
||||
expect {
|
||||
expect(listOf<Int>() as Iterable<Int>).toHaveANextElementFun()
|
||||
}.toThrow<AssertionError> { messageContains("$hasDescr: $nextElementDescr") }
|
||||
}.toThrow<AssertionError> { messageToContain("$hasDescr: $nextElementDescr") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ abstract class IterableExpectationsSpec(
|
||||
it("throws an AssertionError if an iterable has next element") {
|
||||
expect {
|
||||
expect(listOf(1, 2) as Iterable<Int>).notToHaveANextElementFun()
|
||||
}.toThrow<AssertionError> { messageContains("$hasNotDescr: $nextElementDescr") }
|
||||
}.toThrow<AssertionError> { messageToContain("$hasNotDescr: $nextElementDescr") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ abstract class IterableExpectationsSpec(
|
||||
expect {
|
||||
fluent.minFun { toBeLessThan(2) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("min(): 3")
|
||||
messageToContain("min(): 3")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ abstract class IterableExpectationsSpec(
|
||||
expect {
|
||||
fluent.maxFun { toEqual(3) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("max(): 4")
|
||||
messageToContain("max(): 4")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ abstract class IterableExpectationsSpec(
|
||||
expect {
|
||||
emptyIterable.minFun { toEqual(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(noElementsDescr)
|
||||
messageToContain(noElementsDescr)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ abstract class IterableExpectationsSpec(
|
||||
expect {
|
||||
emptyIterable.maxFun { toEqual(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(noElementsDescr)
|
||||
messageToContain(noElementsDescr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
@@ -24,7 +24,7 @@ abstract class IterableLikeToIterableSpec<T>(
|
||||
expect {
|
||||
expect(subject).funIterableLike(input)
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
messageContains("IterableLike without elements are not allowed")
|
||||
messageToContain("IterableLike without elements are not allowed")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ abstract class IterableLikeToIterableSpec<T>(
|
||||
expect {
|
||||
expect(subject).funIterableLike("test")
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"IterableLikeToIterableTransformer accepts arguments of types:",
|
||||
"Iterable, Sequence, Array, CharArray, ByteArray, ShortArray, IntArray, LongArray, FloatArray, DoubleArray and BooleanArray"
|
||||
)
|
||||
|
||||
@@ -157,7 +157,7 @@ abstract class IterableToContainInAnyOrderAtLeast1EntriesExpectationsSpec(
|
||||
expect {
|
||||
expect(oneToSevenNullable()).toContainInAnyOrderNullableEntriesFun({ toEqual(2.0) })
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$rootBulletPoint$toContainInAnyOrder: $separator",
|
||||
"$anElementWhich: $separator",
|
||||
"$toBeDescr: 2.0",
|
||||
@@ -196,7 +196,7 @@ abstract class IterableToContainInAnyOrderAtLeast1EntriesExpectationsSpec(
|
||||
expect {
|
||||
expect(oneToSeven() as Iterable<Double?>).toContainInAnyOrderNullableEntriesFun(null)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$rootBulletPoint$toContainInAnyOrder: $separator",
|
||||
"$anElementWhich: $separator",
|
||||
"$isDescr: null",
|
||||
|
||||
@@ -38,7 +38,7 @@ abstract class IterableToContainInAnyOrderAtLeast1ValuesExpectationsSpec(
|
||||
expect {
|
||||
expect(fluentEmpty()).toContainFun(1.0)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$rootBulletPoint$toContainInAnyOrder: $separator",
|
||||
"$anElementWhichIs: 1.0",
|
||||
"$numberOfOccurrences: 0",
|
||||
@@ -70,7 +70,7 @@ abstract class IterableToContainInAnyOrderAtLeast1ValuesExpectationsSpec(
|
||||
expect {
|
||||
expect(oneToSeven()).toContainFun(9.5)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$rootBulletPoint$toContainInAnyOrder: $separator",
|
||||
"$anElementWhichIs: 9.5",
|
||||
"$numberOfOccurrences: 0",
|
||||
@@ -137,7 +137,7 @@ abstract class IterableToContainInAnyOrderAtLeast1ValuesExpectationsSpec(
|
||||
it("2.5 throws AssertionError") {
|
||||
expect {
|
||||
expect(oneToSevenNullable()).toContainInAnyOrderNullableValuesFun(2.5)
|
||||
}.toThrow<AssertionError> { messageContains(DescriptionIterableAssertion.CONTAINS.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(DescriptionIterableAssertion.CONTAINS.getDefault()) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ abstract class IterableToContainInAnyOrderAtLeastValuesExpectationsSpec(
|
||||
it("for at least -1 -- only positive numbers") {
|
||||
expect {
|
||||
expect(oneToSeven()).toContainAtLeastFun(-1, 9.0)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("positive number", -1) }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("positive number", -1) }
|
||||
}
|
||||
it("for at least 0 -- points to $notToContain") {
|
||||
expect {
|
||||
@@ -90,7 +90,7 @@ abstract class IterableToContainInAnyOrderAtLeastValuesExpectationsSpec(
|
||||
it("${toContainAtLeastPair.first("1.1", "once")} throws AssertionError") {
|
||||
expect {
|
||||
expect(oneToSeven()).toContainAtLeastFun(1, 1.1)
|
||||
}.toThrow<AssertionError> { messageContains("$atLeastDescr: 1", "$anElementWhichIs: 1.1") }
|
||||
}.toThrow<AssertionError> { messageToContain("$atLeastDescr: 1", "$anElementWhichIs: 1.1") }
|
||||
}
|
||||
it("${toContainAtLeastPair.first("1.0, 2.3", "once")} throws AssertionError mentioning only 2.3") {
|
||||
expect {
|
||||
|
||||
@@ -35,7 +35,7 @@ abstract class IterableToContainInAnyOrderAtMostValuesExpectationsSpec(
|
||||
it("for at most -1 -- only positive numbers") {
|
||||
expect {
|
||||
expect(oneToSeven()).toContainAtMostFun(-1, 0.0)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("positive number", -1) }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("positive number", -1) }
|
||||
}
|
||||
it("for at most 0 -- points to $notToContain") {
|
||||
expect {
|
||||
@@ -66,7 +66,7 @@ abstract class IterableToContainInAnyOrderAtMostValuesExpectationsSpec(
|
||||
it("${toContainAtMostPair.first("4.0", "twice")} throws AssertionError") {
|
||||
expect {
|
||||
expect(oneToSeven()).toContainAtMostFun(2, 4.0)
|
||||
}.toThrow<AssertionError> { messageContains("$atMostDescr: 2", "$anElementWhichIs: 4.0") }
|
||||
}.toThrow<AssertionError> { messageToContain("$atMostDescr: 2", "$anElementWhichIs: 4.0") }
|
||||
}
|
||||
it("${toContainAtMostPair.first("1.0, 4.0", "twice")} throws AssertionError mentioning only 4.0") {
|
||||
expect {
|
||||
|
||||
@@ -35,7 +35,7 @@ abstract class IterableToContainInAnyOrderExactlyValuesExpectationsSpec(
|
||||
it("for exactly -1 -- only positive numbers") {
|
||||
expect {
|
||||
expect(oneToSeven()).toContainExactlyFun(-1, 0.0)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("positive number", -1) }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("positive number", -1) }
|
||||
}
|
||||
it("for exactly 0 -- points to $notToContain") {
|
||||
expect {
|
||||
@@ -62,7 +62,7 @@ abstract class IterableToContainInAnyOrderExactlyValuesExpectationsSpec(
|
||||
it("${toContainExactlyPair.first("4.0", "once")} throws AssertionError") {
|
||||
expect {
|
||||
expect(oneToSeven()).toContainExactlyFun(1, 4.0)
|
||||
}.toThrow<AssertionError> { messageContains("$exactly: 1", "$anElementWhichIs: 4.0") }
|
||||
}.toThrow<AssertionError> { messageToContain("$exactly: 1", "$anElementWhichIs: 4.0") }
|
||||
}
|
||||
|
||||
it("${toContainExactlyPair.first("1.0, 2.3", "once")} throws AssertionError mentioning only 2.3") {
|
||||
@@ -111,7 +111,7 @@ abstract class IterableToContainInAnyOrderExactlyValuesExpectationsSpec(
|
||||
it("${toContainExactlyPair.first("5.0", "once")} throws AssertionError") {
|
||||
expect {
|
||||
expect(oneToSeven()).toContainExactlyFun(1, 5.0)
|
||||
}.toThrow<AssertionError> { messageContains(EXACTLY.getDefault()) }
|
||||
}.toThrow<AssertionError> { messageToContain(EXACTLY.getDefault()) }
|
||||
}
|
||||
it("${toContainExactlyPair.first("5.0", "twice")} does not throw") {
|
||||
expect(oneToSeven()).toContainExactlyFun(2, 5.0)
|
||||
|
||||
@@ -33,7 +33,7 @@ abstract class IterableToContainInAnyOrderNotOrAtMostValuesExpectationsSpec(
|
||||
it("for not at all or at most -1 -- only positive numbers") {
|
||||
expect {
|
||||
expect(oneToSeven()).notToContainOrAtMostFun(-1, 0.0)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("positive number", -1) }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("positive number", -1) }
|
||||
}
|
||||
it("for not at all or at most 0 -- points to $notToContain") {
|
||||
expect {
|
||||
@@ -62,7 +62,7 @@ abstract class IterableToContainInAnyOrderNotOrAtMostValuesExpectationsSpec(
|
||||
it("${notToContainOrAtMostPair.first("4.0", "once")} throws AssertionError") {
|
||||
expect {
|
||||
expect(oneToSeven()).notToContainOrAtMostFun(1, 4.0)
|
||||
}.toThrow<AssertionError> { messageContains("$atMostDescr: 1", "$anElementWhichIs: 4.0") }
|
||||
}.toThrow<AssertionError> { messageToContain("$atMostDescr: 1", "$anElementWhichIs: 4.0") }
|
||||
}
|
||||
it("${notToContainOrAtMostPair.first("1.0, 4.0", "once")} throws AssertionError mentioning only 4.0") {
|
||||
expect {
|
||||
|
||||
@@ -153,7 +153,7 @@ abstract class IterableToContainInOrderOnlyGroupedEntriesExpectationsSpec(
|
||||
context(),
|
||||
context({ toEqual(-1.2) })
|
||||
)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("a group of values cannot be empty") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("a group of values cannot be empty") }
|
||||
}
|
||||
it("if an empty group is given as second parameter") {
|
||||
expect {
|
||||
@@ -161,7 +161,7 @@ abstract class IterableToContainInOrderOnlyGroupedEntriesExpectationsSpec(
|
||||
context({ toEqual(1.2) }),
|
||||
context()
|
||||
)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("a group of values cannot be empty") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("a group of values cannot be empty") }
|
||||
}
|
||||
it("if an empty group is given as third parameter") {
|
||||
expect {
|
||||
@@ -170,7 +170,7 @@ abstract class IterableToContainInOrderOnlyGroupedEntriesExpectationsSpec(
|
||||
context({ toEqual(4.3) }),
|
||||
context()
|
||||
)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("a group of values cannot be empty") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("a group of values cannot be empty") }
|
||||
}
|
||||
it("if an empty group is given as fourth parameter") {
|
||||
expect {
|
||||
@@ -180,7 +180,7 @@ abstract class IterableToContainInOrderOnlyGroupedEntriesExpectationsSpec(
|
||||
context({ toEqual(5.7) }),
|
||||
context()
|
||||
)
|
||||
}.toThrow<IllegalArgumentException> { messageContains("a group of values cannot be empty") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("a group of values cannot be empty") }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,22 +137,22 @@ abstract class IterableToContainInOrderOnlyGroupedValuesExpectationsSpec(
|
||||
it("if an empty group is given as first parameter") {
|
||||
expect {
|
||||
expect(oneToFour()).toContainFun(context(), context(-1.2))
|
||||
}.toThrow<IllegalArgumentException> { messageContains("a group of values cannot be empty") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("a group of values cannot be empty") }
|
||||
}
|
||||
it("if an empty group is given as second parameter") {
|
||||
expect {
|
||||
expect(oneToFour()).toContainFun(context(1.2), context())
|
||||
}.toThrow<IllegalArgumentException> { messageContains("a group of values cannot be empty") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("a group of values cannot be empty") }
|
||||
}
|
||||
it("if an empty group is given as third parameter") {
|
||||
expect {
|
||||
expect(oneToFour()).toContainFun(context(1.2), context(4.3), context())
|
||||
}.toThrow<IllegalArgumentException> { messageContains("a group of values cannot be empty") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("a group of values cannot be empty") }
|
||||
}
|
||||
it("if an empty group is given as fourth parameter") {
|
||||
expect {
|
||||
expect(oneToFour()).toContainFun(context(1.2), context(4.3), context(5.7), context())
|
||||
}.toThrow<IllegalArgumentException> { messageContains("a group of values cannot be empty") }
|
||||
}.toThrow<IllegalArgumentException> { messageToContain("a group of values cannot be empty") }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ abstract class IterableToHaveElementsAndAllExpectationsSpec(
|
||||
expect {
|
||||
expect(fluentEmpty()).toHaveElementsAndAllFun { toBeLessThan(1.0) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$rootBulletPoint$featureArrow$hasElement: false$separator" +
|
||||
"$indentRootBulletPoint$indentFeatureArrow$featureBulletPoint$isDescr: true"
|
||||
)
|
||||
|
||||
@@ -42,7 +42,7 @@ abstract class IterableToHaveElementsAndAnyExpectationsSpec(
|
||||
expect {
|
||||
expect(fluentEmpty()).toHaveElementsAndAnyFun { toBeLessThan(1.0) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$rootBulletPoint$toContainInAnyOrder: $separator",
|
||||
"$anElementWhich: $separator",
|
||||
"$toBeLessThanDescr: 1.0",
|
||||
@@ -60,7 +60,7 @@ abstract class IterableToHaveElementsAndAnyExpectationsSpec(
|
||||
expect {
|
||||
expect(oneToSeven()).toHaveElementsAndAnyFun { toBeGreaterThan(1.0); toBeLessThan(2.0) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$rootBulletPoint$toContainInAnyOrder: $separator",
|
||||
"$anElementWhich: $separator",
|
||||
"$isGreaterThanDescr: 1.0",
|
||||
|
||||
@@ -42,7 +42,7 @@ abstract class IterableToHaveElementsAndNoneExpectationsSpec(
|
||||
expect {
|
||||
expect(fluentEmpty()).toHaveElementsAndNoneFun { toBeLessThan(1.0) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$featureArrow$hasElement: false")
|
||||
messageToContain("$featureArrow$hasElement: false")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.specs.*
|
||||
@@ -37,7 +37,7 @@ abstract class IteratorExpectationsSpec(
|
||||
it("throws an AssertionError if an iterator does not have next") {
|
||||
expect {
|
||||
expect(emptyList<Int>().iterator()).toHaveNextFun()
|
||||
}.toThrow<AssertionError> { messageContains("$hasDescriptionBasic: $nextElement") }
|
||||
}.toThrow<AssertionError> { messageToContain("$hasDescriptionBasic: $nextElement") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ abstract class IteratorExpectationsSpec(
|
||||
it("throws an AssertionError if an iterator has next") {
|
||||
expect {
|
||||
expect(listOf(1, 2).iterator()).notToHaveNextFun()
|
||||
}.toThrow<AssertionError> { messageContains("$hasNotDescriptionBasic: $nextElement") }
|
||||
}.toThrow<AssertionError> { messageToContain("$hasNotDescriptionBasic: $nextElement") }
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -78,7 +78,7 @@ abstract class KeyValueLikeExpectationsSpec<T : Any, TNullable : Any>(
|
||||
expect {
|
||||
fluent.keyFun { toEndWith("h") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$keyName: \"hello\"",
|
||||
DescriptionCharSequenceAssertion.ENDS_WITH.getDefault() + ": \"h\""
|
||||
)
|
||||
@@ -94,7 +94,7 @@ abstract class KeyValueLikeExpectationsSpec<T : Any, TNullable : Any>(
|
||||
expect {
|
||||
fluent.valueFun { toBeGreaterThan(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$valueName: 1",
|
||||
DescriptionComparableAssertion.IS_GREATER_THAN.getDefault() + ": 1"
|
||||
)
|
||||
@@ -118,7 +118,7 @@ abstract class KeyValueLikeExpectationsSpec<T : Any, TNullable : Any>(
|
||||
expect {
|
||||
nullableFluent.nullableKeyFun { toEqual(null) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$keyName: \"hello\"")
|
||||
messageToContain("$keyName: \"hello\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ abstract class KeyValueLikeExpectationsSpec<T : Any, TNullable : Any>(
|
||||
expect {
|
||||
nullableFluent.nullableValueFun { toEqual(null) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$valueName: 1")
|
||||
messageToContain("$valueName: 1")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,7 +144,7 @@ abstract class KeyValueLikeExpectationsSpec<T : Any, TNullable : Any>(
|
||||
expect {
|
||||
nullFluent.nullableKeyFun { toEqual("hello") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$keyName: null", "$toBeDescr: \"hello\"")
|
||||
messageToContain("$keyName: null", "$toBeDescr: \"hello\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ abstract class KeyValueLikeExpectationsSpec<T : Any, TNullable : Any>(
|
||||
expect {
|
||||
nullFluent.nullableValueFun { toEqual(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$valueName: null")
|
||||
messageToContain("$valueName: null")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toEqual
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
@@ -62,8 +62,8 @@ abstract class ListExpectationsSpec(
|
||||
expect {
|
||||
fluent.getFun(4) { toEqual(3) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("get(4): $indexOutOfBounds")
|
||||
if (hasExtraHint) messageContains("$toBeDescr: 3")
|
||||
messageToContain("get(4): $indexOutOfBounds")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: 3")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ abstract class MapExpectationsSpec(
|
||||
it("$name - throws an AssertionError if the map does not contain the key") {
|
||||
expect {
|
||||
fluent2.toContainKeyFun("c")
|
||||
}.toThrow<AssertionError> { messageContains("$toContainKeyDescr: \"c\"") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toContainKeyDescr: \"c\"") }
|
||||
}
|
||||
|
||||
it("$name - does not throw if null is passed and the map toContain null as key") {
|
||||
@@ -111,7 +111,7 @@ abstract class MapExpectationsSpec(
|
||||
it("$name - throws an AssertionError if the map toContain the key") {
|
||||
expect {
|
||||
fluent2.notToContainKeyFun("a")
|
||||
}.toThrow<AssertionError> { messageContains("$notToContainKeyDescr: \"a\"") }
|
||||
}.toThrow<AssertionError> { messageToContain("$notToContainKeyDescr: \"a\"") }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ abstract class MapExpectationsSpec(
|
||||
it("${notToContainKeyNullable.name} - throws an AssertionError if the map toContain the key") {
|
||||
expect {
|
||||
expect(map2).notToContainNullableKeyFun(null)
|
||||
}.toThrow<AssertionError> { messageContains("$notToContainKeyDescr: null") }
|
||||
}.toThrow<AssertionError> { messageToContain("$notToContainKeyDescr: null") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ abstract class MapExpectationsSpec(
|
||||
it("${toContainKeyNullable.name} - throws an AssertionError if the map does not contain the key") {
|
||||
expect {
|
||||
expect(map3).toContainNullableKeyFun(null)
|
||||
}.toThrow<AssertionError> { messageContains("$toContainKeyDescr: null") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toContainKeyDescr: null") }
|
||||
}
|
||||
|
||||
it("${notToContainKeyNullable.name} - does not throw if the map does not contain the key") {
|
||||
@@ -161,14 +161,14 @@ abstract class MapExpectationsSpec(
|
||||
it("${notToBeEmpty.name} - throws an AssertionError") {
|
||||
expect {
|
||||
expect(map2).notToBeEmptyFun()
|
||||
}.toThrow<AssertionError> { messageContains("$isNotDescr: $empty") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isNotDescr: $empty") }
|
||||
}
|
||||
}
|
||||
context("$map") {
|
||||
it("${toBeEmpty.name} - throws an AssertionError") {
|
||||
expect {
|
||||
expect(map as Map<*, *>).toBeEmptyFun()
|
||||
}.toThrow<AssertionError> { messageContains("$isDescr: $empty") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isDescr: $empty") }
|
||||
}
|
||||
it("${notToBeEmpty.name} - does not throw") {
|
||||
expect(map as Map<*, *>).notToBeEmptyFun()
|
||||
@@ -189,7 +189,7 @@ abstract class MapExpectationsSpec(
|
||||
expect {
|
||||
fluent.keysFun { toHaveSize(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("keys: [a, b]")
|
||||
messageToContain("keys: [a, b]")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,7 @@ abstract class MapExpectationsSpec(
|
||||
expect {
|
||||
fluent.valuesFun { toHaveSize(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("values: [1, 2]")
|
||||
messageToContain("values: [1, 2]")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,8 +220,8 @@ abstract class MapExpectationsSpec(
|
||||
expect {
|
||||
fluent.getExistingFun("c") { toEqual(3) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("get(\"c\"): $keyDoesNotExist")
|
||||
if (hasExtraHint) messageContains("$toBeDescr: 3")
|
||||
messageToContain("get(\"c\"): $keyDoesNotExist")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: 3")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -246,8 +246,8 @@ abstract class MapExpectationsSpec(
|
||||
expect {
|
||||
nullableFluent.getExistingFun("c") { toEqual(null) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("get(\"c\"): $keyDoesNotExist")
|
||||
if (hasExtraHint) messageContains("$toBeDescr: null")
|
||||
messageToContain("get(\"c\"): $keyDoesNotExist")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: null")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ abstract class MapLikeToIterablePairSpec<T>(
|
||||
expect {
|
||||
expect(subject).funMapLike(input)
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
messageContains("MapLike without entries are not allowed")
|
||||
messageToContain("MapLike without entries are not allowed")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,12 +32,12 @@ abstract class MapLikeToIterablePairSpec<T>(
|
||||
expect {
|
||||
expect(subject).funMapLike(input)
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"MapLikeToIterablePairTransformer accepts arguments of types:",
|
||||
"Map as well as IterableLike with an element type `Pair<*, *>` and `Map.Entry<*, *>`"
|
||||
)
|
||||
cause<IllegalArgumentException> {
|
||||
messageContains("element of Iterable is neither a Pair nor a Map.Entry")
|
||||
messageToContain("element of Iterable is neither a Pair nor a Map.Entry")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,12 +46,12 @@ abstract class MapLikeToIterablePairSpec<T>(
|
||||
expect {
|
||||
expect(subject).funMapLike("test")
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"MapLikeToIterablePairTransformer accepts arguments of types:",
|
||||
"Map as well as IterableLike with an element type `Pair<*, *>` and `Map.Entry<*, *>`"
|
||||
)
|
||||
cause<IllegalArgumentException> {
|
||||
messageContains("IterableLikeToIterableTransformer accepts arguments of types:")
|
||||
messageToContain("IterableLikeToIterableTransformer accepts arguments of types:")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toEqual
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
@@ -28,7 +28,7 @@ abstract class ResultExpectationsSpec(
|
||||
isSuccessFeature.forSubjectLess(),
|
||||
isSuccess.forSubjectLess { toEqual(1) },
|
||||
isFailureFeature.forSubjectLess(),
|
||||
isFailure.forSubjectLess { messageContains("message") }
|
||||
isFailure.forSubjectLess { messageToContain("message") }
|
||||
) {})
|
||||
include(object : SubjectLessSpec<Result<Int?>>(
|
||||
"$describePrefix[nullable] ",
|
||||
@@ -50,7 +50,7 @@ abstract class ResultExpectationsSpec(
|
||||
assertionCreatorSpecTriple(
|
||||
isFailure.name,
|
||||
"${VALUE.getDefault()}: \"oh no...\"",
|
||||
{ apply { isFailure.invoke(this) { messageContains("oh no...") } } },
|
||||
{ apply { isFailure.invoke(this) { messageToContain("oh no...") } } },
|
||||
{ apply { isFailure.invoke(this) {} } }
|
||||
)
|
||||
) {})
|
||||
@@ -83,7 +83,7 @@ abstract class ResultExpectationsSpec(
|
||||
expect {
|
||||
expect(resultSuccess).isSuccessFun { toEqual(2) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("value: 1", "$toBeDescr: 2")
|
||||
messageToContain("value: 1", "$toBeDescr: 2")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,14 +91,14 @@ abstract class ResultExpectationsSpec(
|
||||
failureFunctions.forEach { (name, isFailureFun, hasExtraHint) ->
|
||||
it("$name - throws AssertionError showing the expected type" + if (hasExtraHint) " and the expected message" else "") {
|
||||
expect {
|
||||
expect(resultSuccess).isFailureFun { messageContains("oh yes...") }
|
||||
expect(resultSuccess).isFailureFun { messageToContain("oh yes...") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"exception: $isNotFailureDescr",
|
||||
"$isADescr: ${IllegalArgumentException::class.simpleName}"
|
||||
)
|
||||
if (hasExtraHint) {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
CONTAINS.getDefault(),
|
||||
"${VALUE.getDefault()}: \"oh yes...\""
|
||||
)
|
||||
@@ -114,21 +114,21 @@ abstract class ResultExpectationsSpec(
|
||||
expect {
|
||||
expect(resultFailure).isSuccessFun { toEqual(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("value: $isNotSuccessDescr")
|
||||
if (hasExtraHint) messageContains("$toBeDescr: 1")
|
||||
messageToContain("value: $isNotSuccessDescr")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: 1")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
failureFunctions.forEach { (name, isFailureFun, _) ->
|
||||
it("$name - can perform sub-assertion which holds") {
|
||||
expect(resultFailure).isFailureFun { messageContains("oh no...") }
|
||||
expect(resultFailure).isFailureFun { messageToContain("oh no...") }
|
||||
}
|
||||
it("$name - can perform sub-assertion which fails, throws AssertionError") {
|
||||
expect {
|
||||
expect(resultFailure).isFailureFun { messageContains("oh yes...") }
|
||||
expect(resultFailure).isFailureFun { messageToContain("oh yes...") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"$exceptionDescr: ${IllegalArgumentException::class.fullName}",
|
||||
CONTAINS.getDefault(), "${VALUE.getDefault()}: \"oh yes...\""
|
||||
)
|
||||
@@ -150,7 +150,7 @@ abstract class ResultExpectationsSpec(
|
||||
expect {
|
||||
expect(resultNullSuccess).isSuccessFun { toEqual(2) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("value: null", "$toBeDescr: 2")
|
||||
messageToContain("value: null", "$toBeDescr: 2")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,8 +160,8 @@ abstract class ResultExpectationsSpec(
|
||||
expect {
|
||||
expect(resultNullableFailure).isSuccessFun { toEqual(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("value: $isNotSuccessDescr")
|
||||
if (hasExtraHint) messageContains("$toBeDescr: 1")
|
||||
messageToContain("value: $isNotSuccessDescr")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: 1")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.spekframework.spek2.style.specification.Suite
|
||||
abstract class ThrowableExpectationsSpec(
|
||||
messageFeature: Feature0<Throwable, String>,
|
||||
message: Fun1<Throwable, Expect<String>.() -> Unit>,
|
||||
messageContains: Fun2<Throwable, Any, Array<out Any>>,
|
||||
messageToContain: Fun2<Throwable, Any, Array<out Any>>,
|
||||
|
||||
causeFeature: Feature0<Throwable, IllegalArgumentException>,
|
||||
cause: Feature1<Throwable, Expect<IllegalArgumentException>.() -> Unit, IllegalArgumentException>,
|
||||
@@ -29,7 +29,7 @@ abstract class ThrowableExpectationsSpec(
|
||||
describePrefix,
|
||||
messageFeature.forSubjectLess(),
|
||||
message.forSubjectLess { toEqual("hello") },
|
||||
messageContains.forSubjectLess("hello", arrayOf())
|
||||
messageToContain.forSubjectLess("hello", arrayOf())
|
||||
) {})
|
||||
|
||||
include(object : AssertionCreatorSpec<Throwable>(
|
||||
@@ -40,9 +40,9 @@ abstract class ThrowableExpectationsSpec(
|
||||
fun describeFun(vararg pairs: SpecPair<*>, body: Suite.() -> Unit) =
|
||||
describeFunTemplate(describePrefix, pairs.map { it.name }.toTypedArray(), body = body)
|
||||
|
||||
describeFun(messageFeature, message, messageContains) {
|
||||
describeFun(messageFeature, message, messageToContain) {
|
||||
val messageFunctions = unifySignatures(messageFeature, message)
|
||||
val messageContainsFun = messageContains.lambda
|
||||
val messageContainsFun = messageToContain.lambda
|
||||
|
||||
context("Throwable.message is null") {
|
||||
val throwable: Throwable = IllegalArgumentException()
|
||||
@@ -52,21 +52,21 @@ abstract class ThrowableExpectationsSpec(
|
||||
expect {
|
||||
expect(throwable).messageFun { toEqual("hello") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
DescriptionAnyAssertion.IS_A.getDefault(),
|
||||
String::class.fullName
|
||||
)
|
||||
if (hasExtraHint) messageContains("$toBeDescr: \"hello\"")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: \"hello\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
it("${messageContains.name} - throws an AssertionError which shows intended sub assertion") {
|
||||
it("${messageToContain.name} - throws an AssertionError which shows intended sub assertion") {
|
||||
|
||||
expect {
|
||||
expect(throwable).messageContainsFun(1, arrayOf(2.3, 'z', "hello"))
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
DescriptionAnyAssertion.IS_A.getDefault(), String::class.fullName,
|
||||
CONTAINS.getDefault(),
|
||||
VALUE.getDefault() + ": 1",
|
||||
@@ -84,19 +84,19 @@ abstract class ThrowableExpectationsSpec(
|
||||
it("$name - throws an AssertionError if the assertion does not hold") {
|
||||
expect {
|
||||
expect(throwable).messageFun { toEqual("hello") }
|
||||
}.toThrow<AssertionError> { messageContains("$toBeDescr: \"hello\"") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeDescr: \"hello\"") }
|
||||
}
|
||||
|
||||
it("$name - does not throw if the assertion holds") {
|
||||
expect(throwable).messageFun { toBeEmpty() }
|
||||
}
|
||||
}
|
||||
it("${messageContains.name} - throws an AssertionError if the assertion does not hold") {
|
||||
it("${messageToContain.name} - throws an AssertionError if the assertion does not hold") {
|
||||
expect {
|
||||
expect(throwable).messageContainsFun("nada", arrayOf())
|
||||
}.toThrow<AssertionError> { messageContains(VALUE.getDefault() + ": \"nada\"") }
|
||||
}.toThrow<AssertionError> { messageToContain(VALUE.getDefault() + ": \"nada\"") }
|
||||
}
|
||||
it("${messageContains.name} - throws IllegalArgumentException if empty string is passed") {
|
||||
it("${messageToContain.name} - throws IllegalArgumentException if empty string is passed") {
|
||||
expect {
|
||||
expect(throwable).messageContainsFun("", arrayOf())
|
||||
}.toThrow<IllegalArgumentException>()
|
||||
@@ -109,19 +109,19 @@ abstract class ThrowableExpectationsSpec(
|
||||
it("$name - throws an AssertionError if the assertion does not hold") {
|
||||
expect {
|
||||
expect(throwable).messageFun { toEqual("hello") }
|
||||
}.toThrow<AssertionError> { messageContains("$toBeDescr: \"hello\"") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeDescr: \"hello\"") }
|
||||
}
|
||||
|
||||
it("$name - does not throw if the assertion holds") {
|
||||
expect(throwable).messageFun { toEqual(" ") }
|
||||
}
|
||||
}
|
||||
it("${messageContains.name} - throws an AssertionError if the assertion does not hold") {
|
||||
it("${messageToContain.name} - throws an AssertionError if the assertion does not hold") {
|
||||
expect {
|
||||
expect(throwable).messageContainsFun("nada", arrayOf())
|
||||
}.toThrow<AssertionError> { messageContains(VALUE.getDefault() + ": \"nada\"") }
|
||||
}.toThrow<AssertionError> { messageToContain(VALUE.getDefault() + ": \"nada\"") }
|
||||
}
|
||||
it("${messageContains.name} - does not throw if the assertion holds") {
|
||||
it("${messageToContain.name} - does not throw if the assertion holds") {
|
||||
expect(throwable).messageContainsFun(" ", arrayOf())
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ abstract class ThrowableExpectationsSpec(
|
||||
it("$name - throws an AssertionError if the assertion does not hold") {
|
||||
expect {
|
||||
expect(throwable).messageFun { toEqual("hello") }
|
||||
}.toThrow<AssertionError> { messageContains("$toBeDescr: \"hello\"") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBeDescr: \"hello\"") }
|
||||
}
|
||||
|
||||
it("$name - does not throw if the assertion holds") {
|
||||
@@ -141,17 +141,17 @@ abstract class ThrowableExpectationsSpec(
|
||||
}
|
||||
}
|
||||
|
||||
it("${messageContains.name} - throws an AssertionError if the assertion does not hold") {
|
||||
it("${messageToContain.name} - throws an AssertionError if the assertion does not hold") {
|
||||
expect {
|
||||
expect(throwable).messageContainsFun("nada", arrayOf())
|
||||
}.toThrow<AssertionError> { messageContains(VALUE.getDefault() + ": \"nada\"") }
|
||||
}.toThrow<AssertionError> { messageToContain(VALUE.getDefault() + ": \"nada\"") }
|
||||
}
|
||||
it("${messageContains.name} - does not throw if the assertion holds") {
|
||||
it("${messageToContain.name} - does not throw if the assertion holds") {
|
||||
expect(throwable).messageContainsFun(1, arrayOf(2.3, 'z', "hello"))
|
||||
}
|
||||
}
|
||||
|
||||
it("${messageContains.name} - throws an IllegalArgumentException if an object is passed") {
|
||||
it("${messageToContain.name} - throws an IllegalArgumentException if an object is passed") {
|
||||
val throwable: Throwable = IndexOutOfBoundsException()
|
||||
expect {
|
||||
expect(throwable).messageContainsFun(Pair(1, 2), arrayOf())
|
||||
@@ -174,9 +174,9 @@ abstract class ThrowableExpectationsSpec(
|
||||
|
||||
it("$name - throws an AssertionError") {
|
||||
expect {
|
||||
expect(throwable).causeFun { messageContains("WRONG message") }
|
||||
expect(throwable).causeFun { messageToContain("WRONG message") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
DescriptionThrowableAssertion.OCCURRED_EXCEPTION_CAUSE.getDefault() + ": java.lang.IllegalArgumentException",
|
||||
VALUE.getDefault() + ": \"WRONG message\""
|
||||
)
|
||||
@@ -190,9 +190,9 @@ abstract class ThrowableExpectationsSpec(
|
||||
UnsupportedOperationException("Cause exception: UNSUPPORTED OPERATION")
|
||||
)
|
||||
expect {
|
||||
expect(throwableWithDifferentCauseType).causeFun { messageContains("Cause exception") }
|
||||
expect(throwableWithDifferentCauseType).causeFun { messageToContain("Cause exception") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
String.format(
|
||||
DescriptionThrowableAssertion.OCCURRED_EXCEPTION_PROPERTIES.getDefault(),
|
||||
UnsupportedOperationException::class.simpleName!!
|
||||
@@ -209,9 +209,9 @@ abstract class ThrowableExpectationsSpec(
|
||||
causeFunctions.forEach { (name, causeFun) ->
|
||||
it("$name - throws an AssertionError") {
|
||||
expect {
|
||||
expect(throwable).causeFun { messageContains("Hello") }
|
||||
expect(throwable).causeFun { messageToContain("Hello") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
DescriptionThrowableAssertion.NOT_CAUSED.getDefault(),
|
||||
IllegalArgumentException::class.fullName
|
||||
)
|
||||
|
||||
@@ -113,7 +113,7 @@ abstract class SingleAssertionGroupTypeFormatterSpec<out T : AssertionGroupType>
|
||||
it("throws an UnsupportedOperationException") {
|
||||
expect {
|
||||
testee.formatNonGroup(unsupportedAssertion, parameterObject)
|
||||
}.toThrow<UnsupportedOperationException> { messageContains(supportedAssertionGroupTypeClass.fullName) }
|
||||
}.toThrow<UnsupportedOperationException> { messageToContain(supportedAssertionGroupTypeClass.fullName) }
|
||||
expect(sb).toBeEmpty()
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ abstract class SingleAssertionGroupTypeFormatterSpec<out T : AssertionGroupType>
|
||||
it("throws an UnsupportedOperationException for an ${AssertionGroup::class.simpleName} with type object: ${AssertionGroupType::class.simpleName}") {
|
||||
expect {
|
||||
testee.formatGroup(unsupportedAssertionGroup, parameterObject, doNotFormatChildren)
|
||||
}.toThrow<UnsupportedOperationException> { messageContains(supportedAssertionGroupTypeClass.fullName) }
|
||||
}.toThrow<UnsupportedOperationException> { messageToContain(supportedAssertionGroupTypeClass.fullName) }
|
||||
expect(sb).toBeEmpty()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ch.tutteli.atrium.specs.reporting.translating
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.reporting.translating.Locale
|
||||
@@ -35,7 +36,7 @@ abstract class TranslatorErrorCaseSpec(
|
||||
expect {
|
||||
testeeFactory(locale)
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"The macrolanguage `no` is not supported",
|
||||
locale.toString()
|
||||
)
|
||||
@@ -48,7 +49,7 @@ abstract class TranslatorErrorCaseSpec(
|
||||
expect {
|
||||
testeeFactory(localeGb, locale)
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"The macrolanguage `no` is not supported",
|
||||
locale.toString()
|
||||
)
|
||||
@@ -61,7 +62,7 @@ abstract class TranslatorErrorCaseSpec(
|
||||
expect {
|
||||
testeeFactory(localeGb, localeFr, locale)
|
||||
}.toThrow<IllegalArgumentException> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
"The macrolanguage `no` is not supported",
|
||||
locale.toString()
|
||||
)
|
||||
@@ -77,7 +78,7 @@ abstract class TranslatorErrorCaseSpec(
|
||||
expect {
|
||||
testeeFactory(locale)
|
||||
}
|
||||
.toThrow<IllegalArgumentException> { messageContains("Script `$script` for Locale with language `zh` is not supported.") }
|
||||
.toThrow<IllegalArgumentException> { messageToContain("Script `$script` for Locale with language `zh` is not supported.") }
|
||||
}
|
||||
}
|
||||
context("first fallback Locale is $locale") {
|
||||
@@ -85,7 +86,7 @@ abstract class TranslatorErrorCaseSpec(
|
||||
expect {
|
||||
testeeFactory(localeGb, locale)
|
||||
}
|
||||
.toThrow<IllegalArgumentException> { messageContains("Script `$script` for Locale with language `zh` is not supported.") }
|
||||
.toThrow<IllegalArgumentException> { messageToContain("Script `$script` for Locale with language `zh` is not supported.") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +95,7 @@ abstract class TranslatorErrorCaseSpec(
|
||||
expect {
|
||||
testeeFactory(localeGb, localeFr, locale)
|
||||
}
|
||||
.toThrow<IllegalArgumentException> { messageContains("Script `$script` for Locale with language `zh` is not supported.") }
|
||||
.toThrow<IllegalArgumentException> { messageToContain("Script `$script` for Locale with language `zh` is not supported.") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,11 +112,10 @@ abstract class VerbSpec(
|
||||
assertionVerb(null).notToEqualNull { toEqual(1) }
|
||||
}.toThrow<AssertionError> {
|
||||
@Suppress("DEPRECATION")
|
||||
messageContains(
|
||||
(messageToContain(
|
||||
DescriptionAnyAssertion.IS_A.getDefault(),
|
||||
"Int",
|
||||
"$toBeDescr: 1"
|
||||
)
|
||||
"Int", "$toBeDescr: 1"
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,7 +141,7 @@ abstract class VerbSpec(
|
||||
throw IllegalArgumentException()
|
||||
}.toThrow<UnsupportedOperationException> {}
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
DescriptionAnyAssertion.IS_A.getDefault(),
|
||||
IllegalArgumentException::class.fullName,
|
||||
UnsupportedOperationException::class.fullName
|
||||
|
||||
@@ -60,7 +60,7 @@ abstract class BigDecimalExpectationsSpec(
|
||||
expect {
|
||||
expect(subject).isNotNumericallyEqualToFun(expected)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
subject,
|
||||
"${DescriptionBigDecimalAssertion.IS_NOT_NUMERICALLY_EQUAL_TO.getDefault()}: $expected"
|
||||
)
|
||||
@@ -78,7 +78,7 @@ abstract class BigDecimalExpectationsSpec(
|
||||
expect {
|
||||
expect(subject).isNumericallyEqualToFun(expected)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
subject,
|
||||
"${DescriptionBigDecimalAssertion.IS_NUMERICALLY_EQUAL_TO.getDefault()}: $expected"
|
||||
)
|
||||
@@ -195,7 +195,7 @@ abstract class BigDecimalExpectationsSpec(
|
||||
expect {
|
||||
assertTen.isEqualIncludingScaleFun(expected)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(
|
||||
messageToContain(
|
||||
BigDecimal.TEN,
|
||||
"${DescriptionBigDecimalAssertion.IS_EQUAL_INCLUDING_SCALE.getDefault()}: $expected",
|
||||
failureHintNumerically
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
@@ -84,27 +84,27 @@ abstract class ChronoLocalDateAsStringExpectationsSpec(
|
||||
it("${isBefore.name} throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isBeforeFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
it("${isBeforeOrEqual.name} throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isBeforeOrEqualFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
it("${isAfter.name} throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isAfterFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
it("isAfterOrEqual throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isAfterOrEqualFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
it("${isEqual.name} throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isEqualFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.specs.*
|
||||
@@ -53,12 +53,12 @@ abstract class ChronoLocalDateExpectationsSpec(
|
||||
it("... $december22 throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isBeforeFun(december22)
|
||||
}.toThrow<AssertionError> { messageContains("$isBeforeDescr: $december22") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isBeforeDescr: $december22") }
|
||||
}
|
||||
it("... $december23 throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isBeforeFun(december23)
|
||||
}.toThrow<AssertionError> { messageContains("$isBeforeDescr: $december23") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isBeforeDescr: $december23") }
|
||||
}
|
||||
it("... $december24 does not throw") {
|
||||
fluent.isBeforeFun(december24)
|
||||
@@ -70,7 +70,7 @@ abstract class ChronoLocalDateExpectationsSpec(
|
||||
it("... $december22 throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isBeforeOrEqualFun(december22)
|
||||
}.toThrow<AssertionError> { messageContains("$isBeforeOrEqualDescr: $december22") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isBeforeOrEqualDescr: $december22") }
|
||||
}
|
||||
it("... $december23 does not throw") {
|
||||
fluent.isBeforeOrEqualFun(december23)
|
||||
@@ -88,12 +88,12 @@ abstract class ChronoLocalDateExpectationsSpec(
|
||||
it("... $december23 throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isAfterFun(december23)
|
||||
}.toThrow<AssertionError> { messageContains("$isAfterDescr: $december23") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isAfterDescr: $december23") }
|
||||
}
|
||||
it("... $december24 throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isAfterFun(december24)
|
||||
}.toThrow<AssertionError> { messageContains("$isAfterDescr: $december24") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isAfterDescr: $december24") }
|
||||
}
|
||||
}
|
||||
describe("${isAfterOrEqual.name} ...") {
|
||||
@@ -108,7 +108,7 @@ abstract class ChronoLocalDateExpectationsSpec(
|
||||
it("... $december24 throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isAfterOrEqualFun(december24)
|
||||
}.toThrow<AssertionError> { messageContains("$isAfterOrEqualDescr: $december24") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isAfterOrEqualDescr: $december24") }
|
||||
}
|
||||
}
|
||||
describe("${isEqual.name} ...") {
|
||||
@@ -117,7 +117,7 @@ abstract class ChronoLocalDateExpectationsSpec(
|
||||
it("... $december22 throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isEqualFun(december22)
|
||||
}.toThrow<AssertionError> { messageContains("$isEqualDescr: $december22") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isEqualDescr: $december22") }
|
||||
}
|
||||
it("... $december23 does not throw") {
|
||||
fluent.isEqualFun(december23)
|
||||
@@ -125,7 +125,7 @@ abstract class ChronoLocalDateExpectationsSpec(
|
||||
it("... $december24 throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isEqualFun(december24)
|
||||
}.toThrow<AssertionError> { messageContains("$isEqualDescr: $december24") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isEqualDescr: $december24") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
@@ -93,27 +93,27 @@ abstract class ChronoLocalDateTimeAsStringExpectationsSpec(
|
||||
it("${isBefore.name} throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isBeforeFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
it("${isBeforeOrEqual.name} throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isBeforeOrEqualFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
it("${isAfter.name} throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isAfterFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
it("isAfterOrEqual throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isAfterOrEqualFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
it("${isEqual.name} throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isEqualFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,12 +135,12 @@ abstract class ChronoLocalDateTimeAsStringExpectationsSpec(
|
||||
it("$chronoLocalDateTime ${isBefore.name} $localDateTimeAsString throws an AssertionError") {
|
||||
expect {
|
||||
expect(chronoLocalDateTime).isBeforeFun(localDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_BEFORE.getDefault()}: $localDateTimeAsString") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_BEFORE.getDefault()}: $localDateTimeAsString") }
|
||||
}
|
||||
it("$after ${isBefore.name} $localDateTimeAsString throws an AssertionError") {
|
||||
expect {
|
||||
expect(after).isBeforeFun(localDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_BEFORE.getDefault()}: $localDateTimeAsString") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_BEFORE.getDefault()}: $localDateTimeAsString") }
|
||||
}
|
||||
|
||||
it("$before ${isBeforeOrEqual.name} $localDateTimeAsString does not throw") {
|
||||
@@ -153,19 +153,19 @@ abstract class ChronoLocalDateTimeAsStringExpectationsSpec(
|
||||
expect {
|
||||
expect(after).isBeforeOrEqualFun(localDateTimeAsString)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("${IS_BEFORE_OR_EQUAL.getDefault()}: $localDateTimeAsString")
|
||||
messageToContain("${IS_BEFORE_OR_EQUAL.getDefault()}: $localDateTimeAsString")
|
||||
}
|
||||
}
|
||||
|
||||
it("$before ${isAfter.name} $localDateTimeAsString throws an AssertionError") {
|
||||
expect {
|
||||
expect(before).isAfterFun(localDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_AFTER.getDefault()}: $localDateTimeAsString") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_AFTER.getDefault()}: $localDateTimeAsString") }
|
||||
}
|
||||
it("$chronoLocalDateTime ${isAfter.name} $localDateTimeAsString throws an AssertionError") {
|
||||
expect {
|
||||
expect(chronoLocalDateTime).isAfterFun(localDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_AFTER.getDefault()}: $localDateTimeAsString") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_AFTER.getDefault()}: $localDateTimeAsString") }
|
||||
}
|
||||
it("$after ${isAfter.name} $localDateTimeAsString does not throw") {
|
||||
expect(after).isAfterFun(localDateTimeAsString)
|
||||
@@ -174,7 +174,7 @@ abstract class ChronoLocalDateTimeAsStringExpectationsSpec(
|
||||
it("$before ${isAfterOrEqual.name} $localDateTimeAsString throws an AssertionError") {
|
||||
expect {
|
||||
expect(before).isAfterOrEqualFun(localDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_AFTER_OR_EQUAL.getDefault()}: $localDateTimeAsString") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_AFTER_OR_EQUAL.getDefault()}: $localDateTimeAsString") }
|
||||
}
|
||||
it("$chronoLocalDateTime ${isAfterOrEqual.name} $localDateTimeAsString does not throw") {
|
||||
expect(chronoLocalDateTime).isAfterOrEqualFun(localDateTimeAsString)
|
||||
@@ -186,7 +186,7 @@ abstract class ChronoLocalDateTimeAsStringExpectationsSpec(
|
||||
it("$before ${isEqual.name} $localDateTimeAsString throws an AssertionError") {
|
||||
expect {
|
||||
expect(before).isEqualFun(localDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_EQUAL_TO.getDefault()}: $localDateTimeAsString") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_EQUAL_TO.getDefault()}: $localDateTimeAsString") }
|
||||
}
|
||||
it("$chronoLocalDateTime ${isEqual.name} $localDateTimeAsString does not throw") {
|
||||
expect(chronoLocalDateTime).isEqualFun(localDateTimeAsString)
|
||||
@@ -194,7 +194,7 @@ abstract class ChronoLocalDateTimeAsStringExpectationsSpec(
|
||||
it("$after ${isEqual.name} $localDateTimeAsString throws an AssertionError") {
|
||||
expect {
|
||||
expect(after).isEqualFun(localDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_EQUAL_TO.getDefault()}: $localDateTimeAsString") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_EQUAL_TO.getDefault()}: $localDateTimeAsString") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.specs.*
|
||||
@@ -53,12 +53,12 @@ abstract class ChronoLocalDateTimeExpectationsSpec(
|
||||
it("$ten throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isBeforeFun(ten)
|
||||
}.toThrow<AssertionError> { messageContains("$isBeforeDescr: $ten") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isBeforeDescr: $ten") }
|
||||
}
|
||||
it("$eleven throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isBeforeFun(eleven)
|
||||
}.toThrow<AssertionError> { messageContains("$isBeforeDescr: $eleven") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isBeforeDescr: $eleven") }
|
||||
}
|
||||
it("$twelve does not throw") {
|
||||
fluent.isBeforeFun(twelve)
|
||||
@@ -70,7 +70,7 @@ abstract class ChronoLocalDateTimeExpectationsSpec(
|
||||
it("$ten throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isBeforeOrEqualFun(ten)
|
||||
}.toThrow<AssertionError> { messageContains("$isBeforeOrEqualDescr: $ten") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isBeforeOrEqualDescr: $ten") }
|
||||
}
|
||||
it("$eleven does not throw") {
|
||||
fluent.isBeforeOrEqualFun(eleven)
|
||||
@@ -89,12 +89,12 @@ abstract class ChronoLocalDateTimeExpectationsSpec(
|
||||
it("$eleven throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isAfterFun(eleven)
|
||||
}.toThrow<AssertionError> { messageContains("$isAfterDescr: $eleven") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isAfterDescr: $eleven") }
|
||||
}
|
||||
it("$twelve throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isAfterFun(twelve)
|
||||
}.toThrow<AssertionError> { messageContains("$isAfterDescr: $twelve") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isAfterDescr: $twelve") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ abstract class ChronoLocalDateTimeExpectationsSpec(
|
||||
it("$twelve throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isAfterOrEqualFun(twelve)
|
||||
}.toThrow<AssertionError> { messageContains("$isAfterOrEqualDescr: $twelve") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isAfterOrEqualDescr: $twelve") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ abstract class ChronoLocalDateTimeExpectationsSpec(
|
||||
it("$ten throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isEqualFun(ten)
|
||||
}.toThrow<AssertionError> { messageContains("$isEqualDescr: $ten") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isEqualDescr: $ten") }
|
||||
}
|
||||
it("$eleven does not throw") {
|
||||
fluent.isEqualFun(eleven)
|
||||
@@ -128,7 +128,7 @@ abstract class ChronoLocalDateTimeExpectationsSpec(
|
||||
it("$twelve throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isEqualFun(twelve)
|
||||
}.toThrow<AssertionError> { messageContains("$isEqualDescr: $twelve") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isEqualDescr: $twelve") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
@@ -97,27 +97,27 @@ abstract class ChronoZonedDateTimeAsStringExpectationsSpec(
|
||||
it("${isBefore.name} throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isBeforeFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
it("${isBeforeOrEqual.name} throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isBeforeOrEqualFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
it("${isAfter.name} throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isAfterFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
it("isAfterOrEqual throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isAfterOrEqualFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
it("${isEqual.name} throws a DateTimeParseException") {
|
||||
expect {
|
||||
now.isEqualFun(value)
|
||||
}.toThrow<DateTimeParseException> { messageContains("could not be parsed") }
|
||||
}.toThrow<DateTimeParseException> { messageToContain("could not be parsed") }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,12 +153,12 @@ abstract class ChronoZonedDateTimeAsStringExpectationsSpec(
|
||||
it("$chronoZonedDateTime ${isBefore.name} $zonedDateTimeReferenceValue throws an AssertionError") {
|
||||
expect {
|
||||
expect(chronoZonedDateTime).isBeforeFun(zonedDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_BEFORE.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_BEFORE.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}
|
||||
it("$after ${isBefore.name} $zonedDateTimeReferenceValue throws an AssertionError") {
|
||||
expect {
|
||||
expect(after).isBeforeFun(zonedDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_BEFORE.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_BEFORE.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}
|
||||
|
||||
it("$before ${isBeforeOrEqual.name} $zonedDateTimeReferenceValue does not throw") {
|
||||
@@ -171,19 +171,19 @@ abstract class ChronoZonedDateTimeAsStringExpectationsSpec(
|
||||
expect {
|
||||
expect(after).isBeforeOrEqualFun(zonedDateTimeAsString)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("${IS_BEFORE_OR_EQUAL.getDefault()}: $zonedDateTimeReferenceValue")
|
||||
messageToContain("${IS_BEFORE_OR_EQUAL.getDefault()}: $zonedDateTimeReferenceValue")
|
||||
}
|
||||
}
|
||||
|
||||
it("$before ${isAfter.name} $zonedDateTimeReferenceValue throws an AssertionError") {
|
||||
expect {
|
||||
expect(before).isAfterFun(zonedDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_AFTER.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_AFTER.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}
|
||||
it("$chronoZonedDateTime ${isAfter.name} $zonedDateTimeReferenceValue throws an AssertionError") {
|
||||
expect {
|
||||
expect(chronoZonedDateTime).isAfterFun(zonedDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_AFTER.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_AFTER.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}
|
||||
it("$after ${isAfter.name} $zonedDateTimeAsString does not throw") {
|
||||
expect(after).isAfterFun(zonedDateTimeAsString)
|
||||
@@ -192,7 +192,7 @@ abstract class ChronoZonedDateTimeAsStringExpectationsSpec(
|
||||
it("$before ${isAfterOrEqual.name} $zonedDateTimeReferenceValue throws an AssertionError") {
|
||||
expect {
|
||||
expect(before).isAfterOrEqualFun(zonedDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_AFTER_OR_EQUAL.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_AFTER_OR_EQUAL.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}
|
||||
it("$chronoZonedDateTime ${isAfterOrEqual.name} $zonedDateTimeReferenceValue does not throw") {
|
||||
expect(chronoZonedDateTime).isAfterOrEqualFun(zonedDateTimeAsString)
|
||||
@@ -204,7 +204,7 @@ abstract class ChronoZonedDateTimeAsStringExpectationsSpec(
|
||||
it("$before ${isEqual.name} $zonedDateTimeReferenceValue throws an AssertionError") {
|
||||
expect {
|
||||
expect(before).isEqualFun(zonedDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_EQUAL_TO.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_EQUAL_TO.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}
|
||||
it("$chronoZonedDateTime ${isEqual.name} $zonedDateTimeReferenceValue does not throw") {
|
||||
expect(chronoZonedDateTime).isEqualFun(zonedDateTimeAsString)
|
||||
@@ -212,7 +212,7 @@ abstract class ChronoZonedDateTimeAsStringExpectationsSpec(
|
||||
it("$after ${isEqual.name} $zonedDateTimeReferenceValue throws an AssertionError") {
|
||||
expect {
|
||||
expect(after).isEqualFun(zonedDateTimeAsString)
|
||||
}.toThrow<AssertionError> { messageContains("${IS_EQUAL_TO.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}.toThrow<AssertionError> { messageToContain("${IS_EQUAL_TO.getDefault()}: $zonedDateTimeReferenceValue") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
import ch.tutteli.atrium.specs.*
|
||||
@@ -55,12 +55,12 @@ abstract class ChronoZonedDateTimeExpectationsSpec(
|
||||
it("$ten throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isBeforeFun(ten)
|
||||
}.toThrow<AssertionError> { messageContains("$isBeforeDescr: $ten") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isBeforeDescr: $ten") }
|
||||
}
|
||||
it("$eleven does not throw") {
|
||||
expect {
|
||||
fluent.isBeforeFun(eleven)
|
||||
}.toThrow<AssertionError> { messageContains("$isBeforeDescr: $eleven") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isBeforeDescr: $eleven") }
|
||||
}
|
||||
it("$twelve does not throw") {
|
||||
fluent.isBeforeFun(twelve)
|
||||
@@ -72,7 +72,7 @@ abstract class ChronoZonedDateTimeExpectationsSpec(
|
||||
it("$ten throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isBeforeOrEqualFun(ten)
|
||||
}.toThrow<AssertionError> { messageContains("$isBeforeOrEqualDescr: $ten") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isBeforeOrEqualDescr: $ten") }
|
||||
}
|
||||
it("$eleven does not throw") {
|
||||
fluent.isBeforeOrEqualFun(eleven)
|
||||
@@ -90,12 +90,12 @@ abstract class ChronoZonedDateTimeExpectationsSpec(
|
||||
it("$eleven throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isAfterFun(eleven)
|
||||
}.toThrow<AssertionError> { messageContains("$isAfterDescr: $eleven") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isAfterDescr: $eleven") }
|
||||
}
|
||||
it("$twelve throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isAfterFun(twelve)
|
||||
}.toThrow<AssertionError> { messageContains("$isAfterDescr: $twelve") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isAfterDescr: $twelve") }
|
||||
}
|
||||
}
|
||||
describe("${isAfterOrEqual.name} ...") {
|
||||
@@ -110,7 +110,7 @@ abstract class ChronoZonedDateTimeExpectationsSpec(
|
||||
it("$twelve throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isAfterOrEqualFun(twelve)
|
||||
}.toThrow<AssertionError> { messageContains("$isAfterOrEqualDescr: $twelve") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isAfterOrEqualDescr: $twelve") }
|
||||
}
|
||||
}
|
||||
describe("${isEqual.name} ...") {
|
||||
@@ -119,7 +119,7 @@ abstract class ChronoZonedDateTimeExpectationsSpec(
|
||||
it("$ten throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isEqualFun(ten)
|
||||
}.toThrow<AssertionError> { messageContains("$isEqualDescr: $ten") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isEqualDescr: $ten") }
|
||||
}
|
||||
it("$eleven does not throw") {
|
||||
fluent.isEqualFun(eleven)
|
||||
@@ -127,7 +127,7 @@ abstract class ChronoZonedDateTimeExpectationsSpec(
|
||||
it("$twelve throws an AssertionError") {
|
||||
expect {
|
||||
fluent.isEqualFun(twelve)
|
||||
}.toThrow<AssertionError> { messageContains("$isEqualDescr: $twelve") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isEqualDescr: $twelve") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ abstract class Fun0ExpectationsJvmSpec(
|
||||
}.toThrowFun { message.toEqual("hello") }
|
||||
}.toThrow<AssertionError> {
|
||||
expectSuppressedInReporting()
|
||||
if (hasExtraHint) messageContains("$toBeDescr: \"hello\"")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: \"hello\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ abstract class Fun0ExpectationsJvmSpec(
|
||||
}.notToThrowFun { toEqual(2) }
|
||||
}.toThrow<AssertionError> {
|
||||
expectSuppressedInReporting()
|
||||
if (hasExtraHint) messageContains("$toBeDescr: 2")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: 2")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ abstract class Fun0ExpectationsJvmSpec(
|
||||
}.toThrowFun { message.toEqual("hello") }
|
||||
}.toThrow<AssertionError> {
|
||||
expectSuppressedAndCauseInReporting()
|
||||
if (hasExtraHint) messageContains("$toBeDescr: \"hello\"")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: \"hello\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ abstract class Fun0ExpectationsJvmSpec(
|
||||
}.notToThrowFun { toEqual(2) }
|
||||
}.toThrow<AssertionError> {
|
||||
expectSuppressedAndCauseInReporting()
|
||||
if (hasExtraHint) messageContains("$toBeDescr: 2")
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: 2")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ abstract class LocalDateExpectationsSpec(
|
||||
expect {
|
||||
fluent.yearFun { toBeLessThan(2009) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$yearDescr: 2009")
|
||||
messageToContain("$yearDescr: 2009")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,7 @@ abstract class LocalDateExpectationsSpec(
|
||||
expect {
|
||||
fluent.monthFun { toBeLessThan(3) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$monthDescr: 3")
|
||||
messageToContain("$monthDescr: 3")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ abstract class LocalDateExpectationsSpec(
|
||||
expect {
|
||||
fluent.dayFun { toBeLessThan(5) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$dayDescr: 13")
|
||||
messageToContain("$dayDescr: 13")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ abstract class LocalDateExpectationsSpec(
|
||||
expect {
|
||||
fluent.dayOfWeekFun { toBeLessThan(DayOfWeek.FRIDAY) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$dayOfWeekDescr: ${DayOfWeek.FRIDAY}")
|
||||
messageToContain("$dayOfWeekDescr: ${DayOfWeek.FRIDAY}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ abstract class LocalDateTimeExpectationsSpec(
|
||||
expect {
|
||||
fluent.yearFun { toBeLessThan(2009) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$yearDescr: 2009")
|
||||
messageToContain("$yearDescr: 2009")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ abstract class LocalDateTimeExpectationsSpec(
|
||||
expect {
|
||||
fluent.monthFun { toBeLessThan(5) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$monthDescr: 5")
|
||||
messageToContain("$monthDescr: 5")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ abstract class LocalDateTimeExpectationsSpec(
|
||||
expect {
|
||||
fluent.dayFun { toBeLessThan(5) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$dayDescr: 15")
|
||||
messageToContain("$dayDescr: 15")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ abstract class LocalDateTimeExpectationsSpec(
|
||||
expect {
|
||||
fluent.dayOfWeekFun { toBeLessThan(DayOfWeek.FRIDAY) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$dayOfWeekDescr: ${DayOfWeek.FRIDAY}")
|
||||
messageToContain("$dayOfWeekDescr: ${DayOfWeek.FRIDAY}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.tutteli.atrium.specs.integration
|
||||
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageContains
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.messageToContain
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toEqual
|
||||
import ch.tutteli.atrium.api.fluent.en_GB.toThrow
|
||||
import ch.tutteli.atrium.api.verbs.internal.expect
|
||||
@@ -46,8 +46,8 @@ abstract class OptionalExpectationsSpec(
|
||||
expect {
|
||||
expect(emptyValue).isPresentFun { toEqual(2) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(DescriptionOptionalAssertion.IS_NOT_PRESENT.getDefault())
|
||||
if (hasExtraHint) messageContains("$toBeDescr: 2")
|
||||
messageToContain(DescriptionOptionalAssertion.IS_NOT_PRESENT.getDefault())
|
||||
if (hasExtraHint) messageToContain("$toBeDescr: 2")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ abstract class OptionalExpectationsSpec(
|
||||
expect {
|
||||
expect(presentValue).isEmptyFun()
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$isDescr: ${DescriptionOptionalAssertion.EMPTY.getDefault()}")
|
||||
messageToContain("$isDescr: ${DescriptionOptionalAssertion.EMPTY.getDefault()}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ abstract class PathExpectationsSpec(
|
||||
expect {
|
||||
block(a)
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(String.format(FAILURE_DUE_TO_LINK_LOOP.getDefault(), "$a -> $b -> $a"))
|
||||
messageToContain(String.format(FAILURE_DUE_TO_LINK_LOOP.getDefault(), "$a -> $b -> $a"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ abstract class PathExpectationsSpec(
|
||||
expect {
|
||||
expectPath.startsNotWithFun(Paths.get(path))
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("${STARTS_NOT_WITH.getDefault()}:")
|
||||
messageToContain("${STARTS_NOT_WITH.getDefault()}:")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -347,7 +347,7 @@ abstract class PathExpectationsSpec(
|
||||
expect {
|
||||
expectPath.startsWithFun(Paths.get(path))
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("${STARTS_WITH.getDefault()}:")
|
||||
messageToContain("${STARTS_WITH.getDefault()}:")
|
||||
}
|
||||
}
|
||||
it("${startsNotWith.name} - does not throw") {
|
||||
@@ -390,7 +390,7 @@ abstract class PathExpectationsSpec(
|
||||
expect {
|
||||
expectPath.endsNotWithFun(Paths.get(path))
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("${ENDS_NOT_WITH.getDefault()}:")
|
||||
messageToContain("${ENDS_NOT_WITH.getDefault()}:")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -398,7 +398,7 @@ abstract class PathExpectationsSpec(
|
||||
expect {
|
||||
expectPath.endsWithFun(Paths.get(path))
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("${ENDS_WITH.getDefault()}:")
|
||||
messageToContain("${ENDS_WITH.getDefault()}:")
|
||||
}
|
||||
}
|
||||
it("${endsNotWith.name} - does not throw") {
|
||||
@@ -925,7 +925,7 @@ abstract class PathExpectationsSpec(
|
||||
expect {
|
||||
expect(path).isAbsoluteFun()
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$isDescr: ${ABSOLUTE_PATH.getDefault()}")
|
||||
messageToContain("$isDescr: ${ABSOLUTE_PATH.getDefault()}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -943,7 +943,7 @@ abstract class PathExpectationsSpec(
|
||||
expect {
|
||||
expect(path).isRelativeFun()
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$isDescr: ${RELATIVE_PATH.getDefault()}")
|
||||
messageToContain("$isDescr: ${RELATIVE_PATH.getDefault()}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1386,8 +1386,8 @@ abstract class PathExpectationsSpec(
|
||||
val rootFolder = tempFolder.tmpDir.root
|
||||
expect(rootFolder).parentFun { toEqual(Paths.get("non-existing")) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains(DOES_NOT_HAVE_PARENT.getDefault())
|
||||
if (hasExtraHint) messageContains("non-existing")
|
||||
messageToContain(DOES_NOT_HAVE_PARENT.getDefault())
|
||||
if (hasExtraHint) messageToContain("non-existing")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1415,8 +1415,8 @@ abstract class PathExpectationsSpec(
|
||||
val rootFolder = resolvedFolder.parent
|
||||
expect(rootFolder).resolveFun("non-existing") { toEqual(resolvedFolder) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("non-existing")
|
||||
if (hasExtraHint) messageContains("child")
|
||||
messageToContain("non-existing")
|
||||
if (hasExtraHint) messageToContain("child")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1435,7 +1435,7 @@ abstract class PathExpectationsSpec(
|
||||
expect {
|
||||
expect(Paths.get("a/my")).fileNameFun { toEqual("my.txt") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$fileNameDescr: \"my\"")
|
||||
messageToContain("$fileNameDescr: \"my\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1455,7 +1455,7 @@ abstract class PathExpectationsSpec(
|
||||
expect {
|
||||
expect(Paths.get("a/my.txt")).fileNameWithoutExtensionFun { toEqual("my.txt") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$fileNameWithoutExtensionDescr: \"my\"")
|
||||
messageToContain("$fileNameWithoutExtensionDescr: \"my\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1471,7 +1471,7 @@ abstract class PathExpectationsSpec(
|
||||
expect {
|
||||
expect(Paths.get("a/my/")).fileNameWithoutExtensionFun { toEqual("my.txt") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$fileNameWithoutExtensionDescr: \"my\"")
|
||||
messageToContain("$fileNameWithoutExtensionDescr: \"my\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1486,7 +1486,7 @@ abstract class PathExpectationsSpec(
|
||||
expect {
|
||||
expect(Paths.get("a/my.tar.gz")).fileNameWithoutExtensionFun { toEqual("my") }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$fileNameWithoutExtensionDescr: \"my.tar\"")
|
||||
messageToContain("$fileNameWithoutExtensionDescr: \"my.tar\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ abstract class ZonedDateTimeExpectationsSpec(
|
||||
expect {
|
||||
fluent.yearFun { toBeLessThan(2009) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$yearDescr: 2009")
|
||||
messageToContain("$yearDescr: 2009")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ abstract class ZonedDateTimeExpectationsSpec(
|
||||
expect {
|
||||
fluent.monthFun { toBeLessThan(5) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$monthDescr: 5")
|
||||
messageToContain("$monthDescr: 5")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ abstract class ZonedDateTimeExpectationsSpec(
|
||||
expect {
|
||||
fluent.dayFun { toBeLessThan(5) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$dayDescr: 15")
|
||||
messageToContain("$dayDescr: 15")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ abstract class ZonedDateTimeExpectationsSpec(
|
||||
expect {
|
||||
fluent.dayOfWeekFun { toBeLessThan(DayOfWeek.FRIDAY) }
|
||||
}.toThrow<AssertionError> {
|
||||
messageContains("$dayOfWeekDescr: ${DayOfWeek.FRIDAY}")
|
||||
messageToContain("$dayOfWeekDescr: ${DayOfWeek.FRIDAY}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ abstract class TranslatorIntSpec(
|
||||
it("a failing assertion contains 'ist' instead of 'to be' in the error message") {
|
||||
expect {
|
||||
assertWithDeCh_Fr(1).toEqual(2)
|
||||
}.toThrow<AssertionError> { messageContains("ist: 2") }
|
||||
}.toThrow<AssertionError> { messageToContain("ist: 2") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ abstract class TranslatorIntSpec(
|
||||
it("a failing assertion contains '$text' instead of 'not to be' in the error message") {
|
||||
expect {
|
||||
assertWithDeCh_Fr(1).notToEqual(1)
|
||||
}.toThrow<AssertionError> { messageContains("$text: 1") }
|
||||
}.toThrow<AssertionError> { messageToContain("$text: 1") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ abstract class TranslatorIntSpec(
|
||||
it("a failing assertion contains '$text' instead of 'assert' in the error message") {
|
||||
expect {
|
||||
assertWithDeCh_Fr(1).notToBeTheInstance(1)
|
||||
}.toThrow<AssertionError> { messageContains("$text: 1") }
|
||||
}.toThrow<AssertionError> { messageToContain("$text: 1") }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,7 @@ abstract class TranslatorIntSpec(
|
||||
it("a failing assertion contains '$text' instead of 'assert' in the error message") {
|
||||
expect {
|
||||
assertWithDeCh_Fr(1).toEqual(2)
|
||||
}.toThrow<AssertionError> { messageContains("$text: 1") }
|
||||
}.toThrow<AssertionError> { messageToContain("$text: 1") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ abstract class TranslatorIntSpec(
|
||||
it("throws an AssertionError which message contains the default of $descriptionComparableAssertion.${DescriptionComparableAssertion.IS_LESS_THAN}") {
|
||||
expect {
|
||||
assertWithDeCh_Fr(1).toBeLessThan(1)
|
||||
}.toThrow<AssertionError> { messageContains("${DescriptionComparableAssertion.IS_LESS_THAN.getDefault()}: 1") }
|
||||
}.toThrow<AssertionError> { messageToContain("${DescriptionComparableAssertion.IS_LESS_THAN.getDefault()}: 1") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ abstract class TranslatorIntSpec(
|
||||
firstOfFeb2017
|
||||
), 1
|
||||
) { false })
|
||||
}.toThrow<AssertionError> { messageContains("02/01/17 était Mittwoch!!") }
|
||||
}.toThrow<AssertionError> { messageToContain("02/01/17 était Mittwoch!!") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ abstract class TranslatorIntSpec(
|
||||
firstOfFeb2017
|
||||
), 1
|
||||
) { false })
|
||||
}.toThrow<AssertionError> { messageContains("only Mittwoch") }
|
||||
}.toThrow<AssertionError> { messageToContain("only Mittwoch") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ abstract class TranslatorIntSpec(
|
||||
toBe
|
||||
), 1
|
||||
) { false })
|
||||
}.toThrow<AssertionError> { messageContains("Caractère de remplacement ist") }
|
||||
}.toThrow<AssertionError> { messageToContain("Caractère de remplacement ist") }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,7 +244,7 @@ abstract class TranslatorIntSpec(
|
||||
it("throws an AssertionError which message contains the default of $descriptionComparableAssertion.${DescriptionComparableAssertion.IS_LESS_THAN}") {
|
||||
expect {
|
||||
assertWithDeCh_FrCh_ItCh(1).toBeLessThan(1)
|
||||
}.toThrow<AssertionError> { messageContains("${DescriptionComparableAssertion.IS_LESS_THAN.getDefault()}: 1") }
|
||||
}.toThrow<AssertionError> { messageToContain("${DescriptionComparableAssertion.IS_LESS_THAN.getDefault()}: 1") }
|
||||
}
|
||||
}
|
||||
describe("translation for $testTranslatable.${TestTranslatable.DATE_KNOWN} (with a date as parameter) is provided for 'fr' and 'it'") {
|
||||
@@ -258,7 +258,7 @@ abstract class TranslatorIntSpec(
|
||||
firstOfFeb2017
|
||||
), 1
|
||||
) { false })
|
||||
}.toThrow<AssertionError> { messageContains("02/01/17 était Mittwoch!!") }
|
||||
}.toThrow<AssertionError> { messageToContain("02/01/17 était Mittwoch!!") }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ abstract class TranslatorIntSpec(
|
||||
firstOfFeb2017
|
||||
), 1
|
||||
) { false })
|
||||
}.toThrow<AssertionError> { messageContains("solo Mittwoch!!") }
|
||||
}.toThrow<AssertionError> { messageToContain("solo Mittwoch!!") }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -302,14 +302,14 @@ abstract class TranslatorIntSpec(
|
||||
it("a failing assertion contains '$toBe ${zhWithScript}_$country' instead of 'to be' in the error message") {
|
||||
expect {
|
||||
assert.toEqual(2)
|
||||
}.toThrow<AssertionError> { messageContains("$toBe ${zhWithScript}_$country: 2") }
|
||||
}.toThrow<AssertionError> { messageToContain("$toBe ${zhWithScript}_$country: 2") }
|
||||
}
|
||||
}
|
||||
describe("translation for $descriptionAnyAssertion.$notToBe is provided for 'zh_$country' and for $zhWithScript") {
|
||||
it("a failing assertion contains '$notToBe $zhWithScript' instead of 'to be' in the error message") {
|
||||
expect {
|
||||
assert.notToEqual(1)
|
||||
}.toThrow<AssertionError> { messageContains("$notToBe $zhWithScript: 1") }
|
||||
}.toThrow<AssertionError> { messageToContain("$notToBe $zhWithScript: 1") }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -317,14 +317,14 @@ abstract class TranslatorIntSpec(
|
||||
it("a failing assertion contains '$isNotSame zh_$country' instead of 'to be' in the error message") {
|
||||
expect {
|
||||
assert.notToBeTheInstance(1)
|
||||
}.toThrow<AssertionError> { messageContains("$isNotSame zh_$country: 1") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isNotSame zh_$country: 1") }
|
||||
}
|
||||
}
|
||||
describe("translation for $descriptionAnyAssertion.$isSame is not provided for 'zh_$country' but for zh") {
|
||||
it("a failing assertion contains '$isSame zh' instead of 'to be' in the error message") {
|
||||
expect {
|
||||
assert.toBeTheInstance(2)
|
||||
}.toThrow<AssertionError> { messageContains("$isSame zh: 2") }
|
||||
}.toThrow<AssertionError> { messageToContain("$isSame zh: 2") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ class MostExamplesSpec : Spek({
|
||||
} catch (t: Throwable) {
|
||||
throw IllegalArgumentException("no no no...", t)
|
||||
}
|
||||
}.toThrow<IllegalStateException> { messageContains("no no no") }
|
||||
}.toThrow<IllegalStateException> { messageToContain("no no no") }
|
||||
}
|
||||
|
||||
test("ex-pitfall-1") {
|
||||
|
||||
Reference in New Issue
Block a user