mirror of
https://github.com/jlengrand/atrium.git
synced 2026-03-10 08:01:19 +00:00
This commit is contained in:
@@ -17,6 +17,8 @@ import java.time.chrono.ChronoLocalDateTime
|
|||||||
*
|
*
|
||||||
* @return an [Expect] for the subject of `this` expectation.
|
* @return an [Expect] for the subject of `this` expectation.
|
||||||
*
|
*
|
||||||
|
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeBeforeChronoLocalDateTime
|
||||||
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBefore(
|
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBefore(
|
||||||
@@ -37,6 +39,8 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBefore(
|
|||||||
* @return an [Expect] for the subject of `this` expectation.
|
* @return an [Expect] for the subject of `this` expectation.
|
||||||
* @throws [java.time.DateTimeException] in case an unsupported format is given.
|
* @throws [java.time.DateTimeException] in case an unsupported format is given.
|
||||||
*
|
*
|
||||||
|
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeBeforeString
|
||||||
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBefore(
|
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBefore(
|
||||||
@@ -50,6 +54,8 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBefore(
|
|||||||
*
|
*
|
||||||
* @return an [Expect] for the subject of `this` expectation.
|
* @return an [Expect] for the subject of `this` expectation.
|
||||||
*
|
*
|
||||||
|
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeBeforeOrTheSamePointInTimeAsChronoLocalDateTime
|
||||||
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(
|
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(
|
||||||
@@ -70,6 +76,8 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBeforeOrTheSame
|
|||||||
* @return an [Expect] for the subject of `this` expectation.
|
* @return an [Expect] for the subject of `this` expectation.
|
||||||
* @throws [java.time.DateTimeException] in case an unsupported format is given.
|
* @throws [java.time.DateTimeException] in case an unsupported format is given.
|
||||||
*
|
*
|
||||||
|
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeBeforeOrTheSamePointInTimeAsString
|
||||||
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(
|
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(
|
||||||
@@ -83,6 +91,8 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBeforeOrTheSame
|
|||||||
*
|
*
|
||||||
* @return an [Expect] for the subject of `this` expectation.
|
* @return an [Expect] for the subject of `this` expectation.
|
||||||
*
|
*
|
||||||
|
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeTheSamePointInTimeAsChronoLocalDateTime
|
||||||
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeTheSamePointInTimeAs(
|
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeTheSamePointInTimeAs(
|
||||||
@@ -103,6 +113,8 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeTheSamePointInT
|
|||||||
* @return an [Expect] for the subject of `this` expectation.
|
* @return an [Expect] for the subject of `this` expectation.
|
||||||
* @throws [java.time.DateTimeException] in case an unsupported format is given.
|
* @throws [java.time.DateTimeException] in case an unsupported format is given.
|
||||||
*
|
*
|
||||||
|
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeTheSamePointInTimeAsString
|
||||||
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeTheSamePointInTimeAs(
|
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeTheSamePointInTimeAs(
|
||||||
@@ -116,6 +128,8 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeTheSamePointInT
|
|||||||
*
|
*
|
||||||
* @return an [Expect] for the subject of `this` expectation.
|
* @return an [Expect] for the subject of `this` expectation.
|
||||||
*
|
*
|
||||||
|
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeAfterOrTheSamePointInTimeAsChronoLocalDateTime
|
||||||
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfterOrTheSamePointInTimeAs(
|
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfterOrTheSamePointInTimeAs(
|
||||||
@@ -136,6 +150,8 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfterOrTheSameP
|
|||||||
* @return an [Expect] for the subject of `this` expectation.
|
* @return an [Expect] for the subject of `this` expectation.
|
||||||
* @throws [java.time.DateTimeException] in case an unsupported format is given.
|
* @throws [java.time.DateTimeException] in case an unsupported format is given.
|
||||||
*
|
*
|
||||||
|
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeAfterOrTheSamePointInTimeAsString
|
||||||
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfterOrTheSamePointInTimeAs(
|
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfterOrTheSamePointInTimeAs(
|
||||||
@@ -149,6 +165,8 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfterOrTheSameP
|
|||||||
*
|
*
|
||||||
* @return an [Expect] for the subject of `this` expectation.
|
* @return an [Expect] for the subject of `this` expectation.
|
||||||
*
|
*
|
||||||
|
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeAfterChronoLocalDateTime
|
||||||
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfter(
|
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfter(
|
||||||
@@ -169,6 +187,8 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfter(
|
|||||||
* @return an [Expect] for the subject of `this` expectation.
|
* @return an [Expect] for the subject of `this` expectation.
|
||||||
* @throws [java.time.DateTimeException] in case an unsupported format is given.
|
* @throws [java.time.DateTimeException] in case an unsupported format is given.
|
||||||
*
|
*
|
||||||
|
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.ChronoLocalDateTimeExpectationSamples.toBeAfterString
|
||||||
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfter(
|
fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfter(
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
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.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")
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user