diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/localDateAssertions.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/localDateAssertions.kt index 710d4004a2..2b85d53e98 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/localDateAssertions.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/localDateAssertions.kt @@ -28,6 +28,8 @@ val Expect.year: Expect * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.LocalDateExpectationSamples.year + * * @since 0.9.0 */ fun Expect.year(assertionCreator: Expect.() -> Unit): Expect = @@ -51,6 +53,8 @@ val Expect.month: Expect * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.LocalDateExpectationSamples.month + * * @since 0.9.0 */ fun Expect.month(assertionCreator: Expect.() -> Unit): Expect = @@ -74,6 +78,8 @@ val Expect.dayOfWeek: Expect * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.LocalDateExpectationSamples.dayOfWeek + * * @since 0.9.0 */ fun Expect.dayOfWeek(assertionCreator: Expect.() -> Unit): Expect = @@ -98,6 +104,8 @@ val Expect.day: Expect * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.LocalDateExpectationSamples.day + * * @since 0.9.0 */ fun Expect.day(assertionCreator: Expect.() -> Unit): Expect = diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/LocalDateExpectationSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/LocalDateExpectationSamples.kt new file mode 100644 index 0000000000..2c6598156c --- /dev/null +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/LocalDateExpectationSamples.kt @@ -0,0 +1,81 @@ +package ch.tutteli.atrium.api.fluent.en_GB.samples + +import ch.tutteli.atrium.api.fluent.en_GB.* +import ch.tutteli.atrium.api.verbs.internal.expect +import java.time.DayOfWeek +import java.time.LocalDate +import java.time.Month +import kotlin.test.Test + +class LocalDateExpectationSamples { + + @Test + fun year() { + expect(LocalDate.of(2021, Month.OCTOBER, 9)) + .year { + toEqual(2021) + toBeGreaterThan(2020) + } + + fails { + expect(LocalDate.of(2021, Month.OCTOBER, 9)) + .year { + notToEqual(2022) + toBeGreaterThan(2022) + toBeLessThan(2020) + } + } + } + + @Test + fun month() { + expect(LocalDate.of(2021, Month.OCTOBER, 9)) + .month { + toEqual(Month.OCTOBER.value) + notToEqual(Month.SEPTEMBER.value) + } + + fails { + expect(LocalDate.of(2021, Month.OCTOBER, 9)) + .month { + toEqual(Month.SEPTEMBER.value) + notToEqual(Month.OCTOBER.value) + } + } + } + + @Test + fun dayOfWeek() { + expect(LocalDate.of(2021, Month.OCTOBER, 9)) + .dayOfWeek { + toEqual(DayOfWeek.SATURDAY) + notToEqual(DayOfWeek.SUNDAY) + } + + fails { + expect(LocalDate.of(2021, Month.OCTOBER, 9)) + .dayOfWeek { + toEqual(DayOfWeek.MONDAY) + notToEqual(DayOfWeek.SATURDAY) + } + } + } + + @Test + fun day() { + expect(LocalDate.of(2021, Month.OCTOBER, 9)) + .day { + toEqual(9) + toBeGreaterThan(5) + } + + fails { + expect(LocalDate.of(2021, Month.OCTOBER, 9)) + .day { + toEqual(5) + toBeLessThan(7) + } + } + } + +}