diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/comparableAssertions.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/comparableAssertions.kt index 96af6fc2ff..826563b533 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/comparableAssertions.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/comparableAssertions.kt @@ -8,6 +8,8 @@ import ch.tutteli.atrium.logic.* * The comparison is carried out with [Comparable.compareTo]. * * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.deprecated.ComparableAssertionSamples.isLessThan */ infix fun > Expect.isLessThan(expected: T): Expect = _logicAppend { isLessThan(expected) } @@ -17,6 +19,8 @@ infix fun > Expect.isLessThan(expected: T): Expect = * The comparison is carried out with [Comparable.compareTo]. * * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.deprecated.ComparableAssertionSamples.isLessThanOrEqual */ infix fun > Expect.isLessThanOrEqual(expected: T): Expect = _logicAppend { isLessThanOrEqual(expected) } @@ -26,6 +30,8 @@ infix fun > Expect.isLessThanOrEqual(expected: T): Expect> Expect.isGreaterThan(expected: T): Expect = _logicAppend { isGreaterThan(expected) } @@ -35,6 +41,8 @@ infix fun > Expect.isGreaterThan(expected: T): Expect = * The comparison is carried out with [Comparable.compareTo]. * * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.deprecated.ComparableAssertionSamples.isGreaterThanOrEqual */ infix fun > Expect.isGreaterThanOrEqual(expected: T): Expect = _logicAppend { isGreaterThanOrEqual(expected) } @@ -46,6 +54,8 @@ infix fun > Expect.isGreaterThanOrEqual(expected: T): Expec * @return an [Expect] for the subject of `this` expectation. * * @since 0.13.0 + * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.deprecated.ComparableAssertionSamples.isEqualComparingTo */ infix fun > Expect.isEqualComparingTo(expected: T): Expect = _logicAppend { isEqualComparingTo(expected) } diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/deprecated/ComparableAssertionSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/deprecated/ComparableAssertionSamples.kt new file mode 100644 index 0000000000..73c4a6e815 --- /dev/null +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/deprecated/ComparableAssertionSamples.kt @@ -0,0 +1,63 @@ +//TODO remove file with 1.0.0 +@file:Suppress("DEPRECATION") + +package ch.tutteli.atrium.api.infix.en_GB.samples.deprecated + +import ch.tutteli.atrium.api.infix.en_GB.isEqualComparingTo +import ch.tutteli.atrium.api.infix.en_GB.isGreaterThan +import ch.tutteli.atrium.api.infix.en_GB.isLessThan +import ch.tutteli.atrium.api.infix.en_GB.isLessThanOrEqual +import ch.tutteli.atrium.api.infix.en_GB.samples.fails +import ch.tutteli.atrium.api.verbs.internal.expect +import kotlin.test.Test + +class ComparableAssertionSamples { + + @Test + fun isLessThan() { + expect(1) isLessThan 2 + + fails { + expect(2) isLessThan 1 + } + } + + @Test + fun isLessThanOrEqual() { + expect(1) isLessThanOrEqual 2 + expect(2) isLessThanOrEqual 2 + + fails { + expect(2) isLessThanOrEqual 1 + } + } + + @Test + fun isGreaterThan() { + expect(2) isGreaterThan 1 + + fails { + expect(2) isGreaterThan 2 + } + } + + @Test + fun isGreaterThanOrEqual() { + expect(2) isEqualComparingTo 2 + + fails { + expect(1) isEqualComparingTo 2 + expect(2) isEqualComparingTo 1 + } + } + + @Test + fun isEqualComparingTo() { + expect(2) isEqualComparingTo 2 + + fails { + expect(1) isEqualComparingTo 2 + expect(2) isEqualComparingTo 1 + } + } +}