From 7d0a5d471f1223237f30bb4627c394c6d463c871 Mon Sep 17 00:00:00 2001 From: Wagner Dias Date: Wed, 16 Jun 2021 14:32:32 -0300 Subject: [PATCH] Add ChronoLocalDate, ChronoLocalDateTime and ChronoZonedDateTime expectation samples for the infix api --- .../en_GB/chronoLocalDateExpectations.kt | 20 +++ .../en_GB/chronoLocalDateTimeExpectations.kt | 20 +++ .../en_GB/chronoZonedDateTimeExpectation.kt | 20 +++ .../ChronoLocalDateExpectationSamples.kt | 64 ++++++++++ .../ChronoLocalDateTimeExpectationSamples.kt | 115 ++++++++++++++++++ .../ChronoZonedDateTimeExpectationSamples.kt | 115 ++++++++++++++++++ 6 files changed, 354 insertions(+) create mode 100644 apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ChronoLocalDateExpectationSamples.kt create mode 100644 apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ChronoLocalDateTimeExpectationSamples.kt create mode 100644 apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ChronoZonedDateTimeExpectationSamples.kt diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/chronoLocalDateExpectations.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/chronoLocalDateExpectations.kt index d177cf698..1ac25ecac 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/chronoLocalDateExpectations.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/chronoLocalDateExpectations.kt @@ -15,6 +15,8 @@ import java.time.chrono.ChronoLocalDate * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateExpectationSamples.toBeBeforeChronoLocalDate + * * @since 0.17.0 */ infix fun Expect.toBeBefore(expected: ChronoLocalDate): Expect = @@ -27,6 +29,8 @@ infix fun Expect.toBeBefore(expected: ChronoLocalDate): * @return an [Expect] for the subject of `this` expectation. * @throws [IllegalArgumentException] in case [expected] is not in the form of **yyyy-mm-dd** * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateExpectationSamples.toBeBeforeString + * * @since 0.17.0 */ infix fun Expect.toBeBefore(expected: String): Expect = @@ -39,6 +43,8 @@ infix fun Expect.toBeBefore(expected: String): Expect Expect.toBeBeforeOrTheSamePointInTimeAs(expected: ChronoLocalDate): Expect = @@ -52,6 +58,8 @@ infix fun Expect.toBeBeforeOrTheSamePointInTimeAs(expec * @return an [Expect] for the subject of `this` expectation. * @throws [IllegalArgumentException] in case [expected] is not in the form of **yyyy-mm-dd** * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateExpectationSamples.toBeBeforeOrTheSamePointInTimeAsString + * * @since 0.17.0 */ infix fun Expect.toBeBeforeOrTheSamePointInTimeAs(expected: String): Expect = @@ -64,6 +72,8 @@ infix fun Expect.toBeBeforeOrTheSamePointInTimeAs(expec * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateExpectationSamples.toBeTheSamePointInTimeAsChronoLocalDate + * * @since 0.17.0 */ infix fun Expect.toBeTheSamePointInTimeAs(expected: ChronoLocalDate): Expect = @@ -76,6 +86,8 @@ infix fun Expect.toBeTheSamePointInTimeAs(expected: Chr * @return an [Expect] for the subject of `this` expectation. * @throws [IllegalArgumentException] in case [expected] is not in the form of **yyyy-mm-dd** * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateExpectationSamples.toBeTheSamePointInTimeAsString + * * @since 0.17.0 */ infix fun Expect.toBeTheSamePointInTimeAs(expected: String): Expect = @@ -88,6 +100,8 @@ infix fun Expect.toBeTheSamePointInTimeAs(expected: Str * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateExpectationSamples.toBeAfterOrTheSamePointInTimeAsChronoLocalDate + * * @since 0.17.0 */ infix fun Expect.toBeAfterOrTheSamePointInTimeAs(expected: ChronoLocalDate): Expect = @@ -100,6 +114,8 @@ infix fun Expect.toBeAfterOrTheSamePointInTimeAs(expect * @return an [Expect] for the subject of `this` expectation. * @throws [IllegalArgumentException] in case [expected] is not in the form of **yyyy-mm-dd** * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateExpectationSamples.toBeAfterOrTheSamePointInTimeAsString + * * @since 0.17.0 */ infix fun Expect.toBeAfterOrTheSamePointInTimeAs(expected: String): Expect = @@ -112,6 +128,8 @@ infix fun Expect.toBeAfterOrTheSamePointInTimeAs(expect * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateExpectationSamples.toBeAfterChronoLocalDate + * * @since 0.17.0 */ infix fun Expect.toBeAfter(expected: ChronoLocalDate): Expect = @@ -124,6 +142,8 @@ infix fun Expect.toBeAfter(expected: ChronoLocalDate): * @return an [Expect] for the subject of `this` expectation. * @throws [IllegalArgumentException] in case [expected] is not in the form of **yyyy-mm-dd** * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateExpectationSamples.toBeAfterString + * * @since 0.17.0 */ infix fun Expect.toBeAfter(expected: String): Expect = diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/chronoLocalDateTimeExpectations.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/chronoLocalDateTimeExpectations.kt index e65698d3a..f5909e5d4 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/chronoLocalDateTimeExpectations.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/chronoLocalDateTimeExpectations.kt @@ -17,6 +17,8 @@ import java.time.chrono.ChronoLocalDateTime * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeBeforeChronoLocalDateTime + * * @since 0.17.0 */ infix fun > Expect.toBeBefore( @@ -37,6 +39,8 @@ infix fun > Expect.toBeBefore( * @return an [Expect] for the subject of `this` expectation. * @throws [java.time.DateTimeException] in case an unsupported format is given. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeBeforeString + * * @since 0.17.0 */ infix fun > Expect.toBeBefore( @@ -50,6 +54,8 @@ infix fun > Expect.toBeBefore( * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeBeforeOrTheSamePointInTimeAsChronoLocalDateTime + * * @since 0.17.0 */ infix fun > Expect.toBeBeforeOrTheSamePointInTimeAs( @@ -71,6 +77,8 @@ infix fun > Expect.toBeBeforeOrT * @return an [Expect] for the subject of `this` expectation. * @throws [java.time.DateTimeException] in case an unsupported format is given. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeAfterOrTheSamePointInTimeAsString + * * @since 0.17.0 */ infix fun > Expect.toBeBeforeOrTheSamePointInTimeAs( @@ -84,6 +92,8 @@ infix fun > Expect.toBeBeforeOrT * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeTheSamePointInTimeAsChronoLocalDateTime + * * @since 0.17.0 */ infix fun > Expect.toBeTheSamePointInTimeAs( @@ -104,6 +114,8 @@ infix fun > Expect.toBeTheSamePo * @return an [Expect] for the subject of `this` expectation. * @throws [java.time.DateTimeException] in case an unsupported format is given. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeTheSamePointInTimeAsString + * * @since 0.17.0 */ infix fun > Expect.toBeTheSamePointInTimeAs( @@ -117,6 +129,8 @@ infix fun > Expect.toBeTheSamePo * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeAfterOrTheSamePointInTimeAsChronoLocalDateTime + * * @since 0.17.0 */ infix fun > Expect.toBeAfterOrTheSamePointInTimeAs( @@ -138,6 +152,8 @@ infix fun > Expect.toBeAfterOrTh * @return an [Expect] for the subject of `this` expectation. * @throws [java.time.DateTimeException] in case an unsupported format is given. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeAfterOrTheSamePointInTimeAsString + * * @since 0.17.0 */ infix fun > Expect.toBeAfterOrTheSamePointInTimeAs( @@ -151,6 +167,8 @@ infix fun > Expect.toBeAfterOrTh * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeAfterChronoLocalDateTime + * * @since 0.17.0 */ infix fun > Expect.toBeAfter( @@ -172,6 +190,8 @@ infix fun > Expect.toBeAfter( * @return an [Expect] for the subject of `this` expectation. * @throws [java.time.DateTimeException] in case an unsupported format is given. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeAfterString + * * @since 0.17.0 */ infix fun > Expect.toBeAfter( diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/chronoZonedDateTimeExpectation.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/chronoZonedDateTimeExpectation.kt index 08166b413..c6eb9f08a 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/chronoZonedDateTimeExpectation.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/chronoZonedDateTimeExpectation.kt @@ -16,6 +16,8 @@ import java.time.chrono.ChronoZonedDateTime * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoZonedDateTimeExpectationSamples.toBeBeforeChronoZonedDateTime + * * @since 0.17.0 */ infix fun > Expect.toBeBefore( @@ -51,6 +53,8 @@ infix fun > Expect.toBeBefore( * @return an [Expect] for the subject of `this` expectation. * @throws [java.time.DateTimeException] in case an unsupported format is given. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoZonedDateTimeExpectationSamples.toBeBeforeString + * * @since 0.17.0 */ infix fun > Expect.toBeBefore( @@ -64,6 +68,8 @@ infix fun > Expect.toBeBefore( * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoZonedDateTimeExpectationSamples.toBeBeforeOrTheSamePointInTimeAsChronoZonedDateTime + * * @since 0.17.0 */ infix fun > Expect.toBeBeforeOrTheSamePointInTimeAs( @@ -98,6 +104,8 @@ infix fun > Expect.toBeBeforeOrT * @return an [Expect] for the subject of `this` expectation. * @throws [java.time.DateTimeException] in case an unsupported format is given. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoZonedDateTimeExpectationSamples.toBeBeforeOrTheSamePointInTimeAsString + * * @since 0.17.0 */ infix fun > Expect.toBeBeforeOrTheSamePointInTimeAs( @@ -111,6 +119,8 @@ infix fun > Expect.toBeBeforeOrT * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoZonedDateTimeExpectationSamples.toBeTheSamePointInTimeAsChronoZonedDateTime + * * @since 0.17.0 */ infix fun > Expect.toBeTheSamePointInTimeAs( @@ -145,6 +155,8 @@ infix fun > Expect.toBeTheSamePo * @return an [Expect] for the subject of `this` expectation. * @throws [java.time.DateTimeException] in case an unsupported format is given. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoZonedDateTimeExpectationSamples.toBeTheSamePointInTimeAsString + * * @since 0.17.0 */ infix fun > Expect.toBeTheSamePointInTimeAs( @@ -158,6 +170,8 @@ infix fun > Expect.toBeTheSamePo * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoZonedDateTimeExpectationSamples.toBeAfterOrTheSamePointInTimeAsChronoZonedDateTime + * * @since 0.17.0 */ infix fun > Expect.toBeAfterOrTheSamePointInTimeAs( @@ -192,6 +206,8 @@ infix fun > Expect.toBeAfterOrTh * @return an [Expect] for the subject of `this` expectation. * @throws [java.time.DateTimeException] in case an unsupported format is given. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoZonedDateTimeExpectationSamples.toBeAfterOrTheSamePointInTimeAsString + * * @since 0.17.0 */ infix fun > Expect.toBeAfterOrTheSamePointInTimeAs( @@ -205,6 +221,8 @@ infix fun > Expect.toBeAfterOrTh * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoZonedDateTimeExpectationSamples.toBeAfterChronoZonedDateTime + * * @since 0.17.0 */ infix fun > Expect.toBeAfter( @@ -239,6 +257,8 @@ infix fun > Expect.toBeAfter( * @return an [Expect] for the subject of `this` expectation. * @throws [java.time.DateTimeException] in case an unsupported format is given. * + * @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoZonedDateTimeExpectationSamples.toBeAfterString + * * @since 0.17.0 */ infix fun > Expect.toBeAfter( diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ChronoLocalDateExpectationSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ChronoLocalDateExpectationSamples.kt new file mode 100644 index 000000000..343df311d --- /dev/null +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ChronoLocalDateExpectationSamples.kt @@ -0,0 +1,64 @@ +package ch.tutteli.atrium.api.infix.en_GB.samples + +import ch.tutteli.atrium.api.infix.en_GB.* +import ch.tutteli.atrium.api.verbs.internal.expect +import java.time.LocalDate +import java.time.Month +import kotlin.test.Test + +class ChronoLocalDateExpectationSamples { + + @Test + fun toBeBeforeChronoLocalDate() { + expect(LocalDate.of(2021, Month.JUNE, 6)) toBeBefore LocalDate.of(2021, Month.JULY, 1) + } + + @Test + fun toBeBeforeString() { + expect(LocalDate.of(2021, Month.JUNE, 6)) toBeBefore "2021-07-01" + } + + @Test + fun toBeBeforeOrTheSamePointInTimeAsChronoLocalDate() { + expect(LocalDate.of(2021, Month.JUNE, 6)) toBeBeforeOrTheSamePointInTimeAs LocalDate.of(2021, Month.JULY, 1) + expect(LocalDate.of(2021, Month.JUNE, 6)) toBeBeforeOrTheSamePointInTimeAs LocalDate.of(2021, Month.JUNE, 6) + } + + @Test + fun toBeBeforeOrTheSamePointInTimeAsString() { + expect(LocalDate.of(2021, Month.JUNE, 6)) toBeBeforeOrTheSamePointInTimeAs "2021-07-01" + expect(LocalDate.of(2021, Month.JUNE, 6)) toBeBeforeOrTheSamePointInTimeAs "2021-06-06" + } + + @Test + fun toBeTheSamePointInTimeAsChronoLocalDate() { + expect(LocalDate.of(2021, Month.JUNE, 6)) toBeTheSamePointInTimeAs LocalDate.of(2021, Month.JUNE, 6) + } + + @Test + fun toBeTheSamePointInTimeAsString() { + expect(LocalDate.of(2021, Month.JUNE, 6)) toBeTheSamePointInTimeAs "2021-06-06" + } + + @Test + fun toBeAfterOrTheSamePointInTimeAsChronoLocalDate() { + expect(LocalDate.of(2021, Month.AUGUST, 6)) toBeAfterOrTheSamePointInTimeAs LocalDate.of(2021, Month.JULY, 1) + expect(LocalDate.of(2021, Month.JULY, 1)) toBeAfterOrTheSamePointInTimeAs LocalDate.of(2021, Month.JULY, 1) + } + + @Test + fun toBeAfterOrTheSamePointInTimeAsString() { + expect(LocalDate.of(2021, Month.AUGUST, 6)) toBeAfterOrTheSamePointInTimeAs "2021-07-01" + expect(LocalDate.of(2021, Month.JULY, 1)) toBeAfterOrTheSamePointInTimeAs "2021-07-01" + } + + @Test + fun toBeAfterChronoLocalDate() { + expect(LocalDate.of(2021, Month.AUGUST, 6)) toBeAfter LocalDate.of(2021, Month.JULY, 1) + } + + @Test + fun toBeAfterString() { + expect(LocalDate.of(2021, Month.AUGUST, 6)) toBeAfter "2021-07-01" + } +} diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ChronoLocalDateTimeExpectationSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ChronoLocalDateTimeExpectationSamples.kt new file mode 100644 index 000000000..71c20dd33 --- /dev/null +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ChronoLocalDateTimeExpectationSamples.kt @@ -0,0 +1,115 @@ +package ch.tutteli.atrium.api.infix.en_GB.samples + +import ch.tutteli.atrium.api.infix.en_GB.* +import ch.tutteli.atrium.api.verbs.internal.expect +import java.time.LocalDateTime +import java.time.Month +import kotlin.test.Test + +class ChronoLocalDateTimeExpectationSamples { + + @Test + fun toBeBeforeChronoLocalDateTime() { + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeBefore LocalDateTime.of(2021, Month.JUNE, 6, 12, 10, 0, 0) + } + + @Test + fun toBeBeforeString() { + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeBefore "2021-06-06T12:10:00.000000000" + + // format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeBefore "2021-06-06T12:10:00" + + // format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeBefore "2021-06-06T12:10" + + // format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeBefore "2021-06-07" + } + + @Test + fun toBeBeforeOrTheSamePointInTimeAsChronoLocalDateTime() { + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeBeforeOrTheSamePointInTimeAs LocalDateTime.of(2021, Month.JUNE, 6, 12, 10, 0, 0) + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeBeforeOrTheSamePointInTimeAs LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103) + } + + @Test + fun toBeBeforeOrTheSamePointInTimeAsString() { + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeBeforeOrTheSamePointInTimeAs "2021-06-06T12:10:00.000000000" + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeBeforeOrTheSamePointInTimeAs "2021-06-06T10:05:35.000000103" + + // format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 34, 0)) toBeBeforeOrTheSamePointInTimeAs "2021-06-06T12:10:00" + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 0)) toBeBeforeOrTheSamePointInTimeAs "2021-06-06T10:05:35" + + // format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeBeforeOrTheSamePointInTimeAs "2021-06-06T12:10" + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 0, 0)) toBeBeforeOrTheSamePointInTimeAs "2021-06-06T10:05" + + // format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeBeforeOrTheSamePointInTimeAs "2021-06-07" + expect(LocalDateTime.of(2021, Month.JUNE, 6, 0, 0, 0, 0)) toBeBeforeOrTheSamePointInTimeAs "2021-06-06" + } + + @Test + fun toBeTheSamePointInTimeAsChronoLocalDateTime() { + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeTheSamePointInTimeAs LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103) + } + + @Test + fun toBeTheSamePointInTimeAsString() { + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeTheSamePointInTimeAs "2021-06-06T10:05:35.000000103" + + // format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 0)) toBeTheSamePointInTimeAs "2021-06-06T10:05:35" + + // format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 0, 0)) toBeTheSamePointInTimeAs "2021-06-06T10:05" + + // format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 0, 0, 0, 0)) toBeTheSamePointInTimeAs "2021-06-06" + } + + @Test + fun toBeAfterOrTheSamePointInTimeAsChronoLocalDateTime() { + expect(LocalDateTime.of(2021, Month.JUNE, 6, 12, 10, 0, 0)) toBeAfterOrTheSamePointInTimeAs LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103) + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeAfterOrTheSamePointInTimeAs LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103) + } + + @Test + fun toBeAfterOrTheSamePointInTimeAsString() { + expect(LocalDateTime.of(2021, Month.JUNE, 6, 12, 10, 0, 0)) toBeAfterOrTheSamePointInTimeAs "2021-06-06T10:05:35.000000103" + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103)) toBeAfterOrTheSamePointInTimeAs "2021-06-06T10:05:35.000000103" + + // format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 12, 10, 0, 0)) toBeAfterOrTheSamePointInTimeAs "2021-06-06T10:05:35" + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 0)) toBeAfterOrTheSamePointInTimeAs "2021-06-06T10:05:35" + + // format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 12, 10, 0, 0)) toBeAfterOrTheSamePointInTimeAs "2021-06-06T10:05" + expect(LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 0, 0)) toBeAfterOrTheSamePointInTimeAs "2021-06-06T10:05" + + // format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 12, 10, 0, 0)) toBeAfterOrTheSamePointInTimeAs "2021-06-06" + expect(LocalDateTime.of(2021, Month.JUNE, 6, 0, 0, 0, 0)) toBeAfterOrTheSamePointInTimeAs "2021-06-06" + } + + @Test + fun toBeAfterChronoLocalDateTime() { + expect(LocalDateTime.of(2021, Month.JUNE, 6, 12, 10, 0, 0)) toBeAfter LocalDateTime.of(2021, Month.JUNE, 6, 10, 5, 35, 103) + } + + @Test + fun toBeAfterString() { + expect(LocalDateTime.of(2021, Month.JUNE, 6, 12, 10, 0, 0)) toBeAfter "2021-06-06T10:05:35.103000000" + + // format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 12, 10, 0, 0)) toBeAfter "2021-06-06T10:05:35" + + // format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 12, 10, 0, 0)) toBeAfter "2021-06-06T10:05" + + // format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part + expect(LocalDateTime.of(2021, Month.JUNE, 6, 12, 10, 0, 0)) toBeAfter "2021-06-06" + } +} diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ChronoZonedDateTimeExpectationSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ChronoZonedDateTimeExpectationSamples.kt new file mode 100644 index 000000000..51440628f --- /dev/null +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ChronoZonedDateTimeExpectationSamples.kt @@ -0,0 +1,115 @@ +package ch.tutteli.atrium.api.infix.en_GB.samples + +import ch.tutteli.atrium.api.infix.en_GB.* +import ch.tutteli.atrium.api.verbs.internal.expect +import java.time.ZoneId +import java.time.ZonedDateTime +import kotlin.test.Test + +class ChronoZonedDateTimeExpectationSamples { + + @Test + fun toBeBeforeChronoZonedDateTime() { + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeBefore ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")) + } + + @Test + fun toBeBeforeString() { + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeBefore "2021-06-06T12:10:00.000000000-03:00" + + // format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeBefore "2021-06-06T12:10:00-03:00" + + // format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeBefore "2021-06-06T12:10-03:00" + + // format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeBefore "2021-06-07-03:00" + } + + @Test + fun toBeBeforeOrTheSamePointInTimeAsChronoZonedDateTime() { + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeBeforeOrTheSamePointInTimeAs ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")) + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeBeforeOrTheSamePointInTimeAs ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")) + } + + @Test + fun toBeBeforeOrTheSamePointInTimeAsString() { + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeBeforeOrTheSamePointInTimeAs "2021-06-06T12:10:00.000000000-03:00" + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeBeforeOrTheSamePointInTimeAs "2021-06-06T10:05:35.000000103-03:00" + + // format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 34, 0, ZoneId.of("America/Sao_Paulo"))) toBeBeforeOrTheSamePointInTimeAs "2021-06-06T12:10:00-03:00" + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 0, ZoneId.of("America/Sao_Paulo"))) toBeBeforeOrTheSamePointInTimeAs "2021-06-06T10:05:35-03:00" + + // format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeBeforeOrTheSamePointInTimeAs "2021-06-06T12:10-03:00" + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeBeforeOrTheSamePointInTimeAs "2021-06-06T10:05-03:00" + + // format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeBeforeOrTheSamePointInTimeAs "2021-06-07-03:00" + expect(ZonedDateTime.of(2021, 6, 6, 0, 0, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeBeforeOrTheSamePointInTimeAs "2021-06-06-03:00" + } + + @Test + fun toBeTheSamePointInTimeAsChronoZonedDateTime() { + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeTheSamePointInTimeAs ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")) + } + + @Test + fun toBeTheSamePointInTimeAsString() { + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeTheSamePointInTimeAs "2021-06-06T10:05:35.000000103-03:00" + + // format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 0, ZoneId.of("America/Sao_Paulo"))) toBeTheSamePointInTimeAs "2021-06-06T10:05:35-03:00" + + // format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeTheSamePointInTimeAs "2021-06-06T10:05-03:00" + + // format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 0, 0, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeTheSamePointInTimeAs "2021-06-06-03:00" + } + + @Test + fun toBeAfterOrTheSamePointInTimeAsChronoZonedDateTime() { + expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfterOrTheSamePointInTimeAs ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")) + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeAfterOrTheSamePointInTimeAs ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")) + } + + @Test + fun toBeAfterOrTheSamePointInTimeAsString() { + expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfterOrTheSamePointInTimeAs "2021-06-06T10:05:35.000000103-03:00" + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo"))) toBeAfterOrTheSamePointInTimeAs "2021-06-06T10:05:35.000000103-03:00" + + // format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfterOrTheSamePointInTimeAs "2021-06-06T10:05:35-03:00" + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfterOrTheSamePointInTimeAs "2021-06-06T10:05:35-03:00" + + // format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfterOrTheSamePointInTimeAs "2021-06-06T10:05-03:00" + expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfterOrTheSamePointInTimeAs "2021-06-06T10:05-03:00" + + // format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfterOrTheSamePointInTimeAs "2021-06-06-03:00" + expect(ZonedDateTime.of(2021, 6, 6, 0, 0, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfterOrTheSamePointInTimeAs "2021-06-06-03:00" + } + + @Test + fun toBeAfterChronoZonedDateTime() { + expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfter ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")) + } + + @Test + fun toBeAfterString() { + expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfter "2021-06-06T10:05:35.103000000-03:00" + + // format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfter "2021-06-06T10:05:35-03:00" + + // format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfter "2021-06-06T10:05-03:00" + + // format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part + expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo"))) toBeAfter "2021-06-06-03:00" + } +}