mirror of
https://github.com/jlengrand/atrium.git
synced 2026-03-10 08:01:19 +00:00
Add samples for chronoLocalDateExpectations of api-fluent (#914)
This commit is contained in:
@@ -15,6 +15,8 @@ import java.time.chrono.ChronoLocalDate
|
||||
*
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
*
|
||||
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateExpectationSamples.toBeBeforeChronoLocalDate
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
fun <T : ChronoLocalDate> Expect<T>.toBeBefore(expected: ChronoLocalDate): Expect<T> =
|
||||
@@ -27,6 +29,8 @@ fun <T : ChronoLocalDate> Expect<T>.toBeBefore(expected: ChronoLocalDate): Expec
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
* @throws [java.time.DateTimeException] in case [expected] is not in the form of **yyyy-mm-dd**
|
||||
*
|
||||
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateExpectationSamples.toBeBeforeString
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
fun <T : ChronoLocalDate> Expect<T>.toBeBefore(expected: String): Expect<T> =
|
||||
@@ -39,6 +43,8 @@ fun <T : ChronoLocalDate> Expect<T>.toBeBefore(expected: String): Expect<T> =
|
||||
*
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
*
|
||||
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateExpectationSamples.toBeBeforeOrTheSamePointInTimeAsChronoLocalDate
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
fun <T : ChronoLocalDate> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(expected: ChronoLocalDate): Expect<T> =
|
||||
@@ -51,6 +57,8 @@ fun <T : ChronoLocalDate> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(expected: C
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
* @throws [java.time.DateTimeException] in case [expected] is not in the form of **yyyy-mm-dd**
|
||||
*
|
||||
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateExpectationSamples.toBeBeforeOrTheSamePointInTimeAsString
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
fun <T : ChronoLocalDate> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(expected: String): Expect<T> =
|
||||
@@ -63,6 +71,8 @@ fun <T : ChronoLocalDate> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(expected: S
|
||||
*
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
*
|
||||
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateExpectationSamples.toBeTheSamePointInTimeAsChronoLocalDate
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
fun <T : ChronoLocalDate> Expect<T>.toBeTheSamePointInTimeAs(expected: ChronoLocalDate): Expect<T> =
|
||||
@@ -75,6 +85,8 @@ fun <T : ChronoLocalDate> Expect<T>.toBeTheSamePointInTimeAs(expected: ChronoLoc
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
* @throws [java.time.DateTimeException] in case [expected] is not in the form of **yyyy-mm-dd**
|
||||
*
|
||||
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateExpectationSamples.toBeTheSamePointInTimeAsString
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
fun <T : ChronoLocalDate> Expect<T>.toBeTheSamePointInTimeAs(expected: String): Expect<T> =
|
||||
@@ -86,6 +98,8 @@ fun <T : ChronoLocalDate> Expect<T>.toBeTheSamePointInTimeAs(expected: String):
|
||||
*
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
*
|
||||
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateExpectationSamples.toBeAfterOrTheSamePointInTimeAsChronoLocalDate
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
fun <T : ChronoLocalDate> Expect<T>.toBeAfterOrTheSamePointInTimeAs(expected: ChronoLocalDate): Expect<T> =
|
||||
@@ -98,6 +112,8 @@ fun <T : ChronoLocalDate> Expect<T>.toBeAfterOrTheSamePointInTimeAs(expected: Ch
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
* @throws [java.time.DateTimeException] in case [expected] is not in the form of **yyyy-mm-dd**
|
||||
*
|
||||
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateExpectationSamples.toBeAfterOrTheSamePointInTimeAsString
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
fun <T : ChronoLocalDate> Expect<T>.toBeAfterOrTheSamePointInTimeAs(expected: String): Expect<T> =
|
||||
@@ -110,6 +126,8 @@ fun <T : ChronoLocalDate> Expect<T>.toBeAfterOrTheSamePointInTimeAs(expected: St
|
||||
*
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
*
|
||||
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateExpectationSamples.toBeAfterChronoLocalDate
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
fun <T : ChronoLocalDate> Expect<T>.toBeAfter(expected: ChronoLocalDate): Expect<T> =
|
||||
@@ -122,6 +140,8 @@ fun <T : ChronoLocalDate> Expect<T>.toBeAfter(expected: ChronoLocalDate): Expect
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
* @throws [java.time.DateTimeException] in case [expected] is not in the form of **yyyy-mm-dd**
|
||||
*
|
||||
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateExpectationSamples.toBeAfterString
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
fun <T : ChronoLocalDate> Expect<T>.toBeAfter(expected: String): Expect<T> =
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
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.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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user