mirror of
https://github.com/jlengrand/atrium.git
synced 2026-03-10 08:01:19 +00:00
Merge pull request #941 from dias-wagner/dias-wagner/infix-chrono-expectations-samples
Add ChronoLocalDate, ChronoLocalDateTime and ChronoZonedDateTime expe…
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.infix.en_GB.samples.ChronoLocalDateExpectationSamples.toBeBeforeChronoLocalDate
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
infix fun <T : ChronoLocalDate> Expect<T>.toBeBefore(expected: ChronoLocalDate): Expect<T> =
|
||||
@@ -27,6 +29,8 @@ infix fun <T : ChronoLocalDate> Expect<T>.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 <T : ChronoLocalDate> Expect<T>.toBeBefore(expected: String): Expect<T> =
|
||||
@@ -39,6 +43,8 @@ infix fun <T : ChronoLocalDate> Expect<T>.toBeBefore(expected: String): Expect<T
|
||||
*
|
||||
* @return an [Expect] for the subject of `this` expectation.
|
||||
*
|
||||
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.ChronoLocalDateExpectationSamples.toBeBeforeOrTheSamePointInTimeAsChronoLocalDate
|
||||
*
|
||||
* @since 0.17.0
|
||||
*/
|
||||
infix fun <T : ChronoLocalDate> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(expected: ChronoLocalDate): Expect<T> =
|
||||
@@ -52,6 +58,8 @@ infix fun <T : ChronoLocalDate> Expect<T>.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 <T : ChronoLocalDate> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(expected: String): Expect<T> =
|
||||
@@ -64,6 +72,8 @@ infix fun <T : ChronoLocalDate> Expect<T>.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 <T : ChronoLocalDate> Expect<T>.toBeTheSamePointInTimeAs(expected: ChronoLocalDate): Expect<T> =
|
||||
@@ -76,6 +86,8 @@ infix fun <T : ChronoLocalDate> Expect<T>.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 <T : ChronoLocalDate> Expect<T>.toBeTheSamePointInTimeAs(expected: String): Expect<T> =
|
||||
@@ -88,6 +100,8 @@ infix fun <T : ChronoLocalDate> Expect<T>.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 <T : ChronoLocalDate> Expect<T>.toBeAfterOrTheSamePointInTimeAs(expected: ChronoLocalDate): Expect<T> =
|
||||
@@ -100,6 +114,8 @@ infix fun <T : ChronoLocalDate> Expect<T>.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 <T : ChronoLocalDate> Expect<T>.toBeAfterOrTheSamePointInTimeAs(expected: String): Expect<T> =
|
||||
@@ -112,6 +128,8 @@ infix fun <T : ChronoLocalDate> Expect<T>.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 <T : ChronoLocalDate> Expect<T>.toBeAfter(expected: ChronoLocalDate): Expect<T> =
|
||||
@@ -124,6 +142,8 @@ infix fun <T : ChronoLocalDate> Expect<T>.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 <T : ChronoLocalDate> Expect<T>.toBeAfter(expected: String): Expect<T> =
|
||||
|
||||
@@ -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 <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBefore(
|
||||
@@ -37,6 +39,8 @@ infix fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBefore(
|
||||
@@ -50,6 +54,8 @@ infix fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(
|
||||
@@ -71,6 +77,8 @@ infix fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(
|
||||
@@ -84,6 +92,8 @@ infix fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeTheSamePointInTimeAs(
|
||||
@@ -104,6 +114,8 @@ infix fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeTheSamePointInTimeAs(
|
||||
@@ -117,6 +129,8 @@ infix fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfterOrTheSamePointInTimeAs(
|
||||
@@ -138,6 +152,8 @@ infix fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfterOrTheSamePointInTimeAs(
|
||||
@@ -151,6 +167,8 @@ infix fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfter(
|
||||
@@ -172,6 +190,8 @@ infix fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.toBeAfter(
|
||||
|
||||
@@ -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 <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.toBeBefore(
|
||||
@@ -51,6 +53,8 @@ infix fun <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.toBeBefore(
|
||||
@@ -64,6 +68,8 @@ infix fun <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(
|
||||
@@ -98,6 +104,8 @@ infix fun <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.toBeBeforeOrTheSamePointInTimeAs(
|
||||
@@ -111,6 +119,8 @@ infix fun <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.toBeTheSamePointInTimeAs(
|
||||
@@ -145,6 +155,8 @@ infix fun <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.toBeTheSamePointInTimeAs(
|
||||
@@ -158,6 +170,8 @@ infix fun <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.toBeAfterOrTheSamePointInTimeAs(
|
||||
@@ -192,6 +206,8 @@ infix fun <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.toBeAfterOrTheSamePointInTimeAs(
|
||||
@@ -205,6 +221,8 @@ infix fun <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.toBeAfter(
|
||||
@@ -239,6 +257,8 @@ infix fun <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.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 <T : ChronoZonedDateTime<out ChronoLocalDate>> Expect<T>.toBeAfter(
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user