forked from robstoll/atrium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add samples for localDateTimeAssertions of api-infix (robstoll#997)
- Loading branch information
1 parent
ea6230b
commit 04a0e50
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
.../test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/LocalDateTimeExpectationSamples.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
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.DayOfWeek | ||
import java.time.LocalDateTime | ||
import java.time.Month | ||
import kotlin.test.Test | ||
|
||
class LocalDateTimeExpectationSamples { | ||
|
||
@Test | ||
fun year() { | ||
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) year { | ||
it toEqual 2021 | ||
it toBeGreaterThan 2020 | ||
} | ||
|
||
fails { | ||
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) year { | ||
it notToEqual 2022 | ||
it toBeGreaterThan 2022 | ||
it toBeLessThan 2020 | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun month() { | ||
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) month { | ||
it toEqual Month.OCTOBER.value | ||
it notToEqual Month.SEPTEMBER.value | ||
} | ||
|
||
fails { | ||
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) month { | ||
it toEqual Month.SEPTEMBER.value | ||
it notToEqual Month.OCTOBER.value | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun dayOfWeek() { | ||
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) dayOfWeek { | ||
it toEqual DayOfWeek.SATURDAY | ||
it notToEqual DayOfWeek.SUNDAY | ||
} | ||
|
||
fails { | ||
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) dayOfWeek { | ||
it toEqual DayOfWeek.MONDAY | ||
it notToEqual DayOfWeek.SATURDAY | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun day() { | ||
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) day { | ||
it toEqual 9 | ||
it toBeGreaterThan 5 | ||
} | ||
|
||
fails { | ||
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) day { | ||
it toEqual 5 | ||
it toBeLessThan 7 | ||
} | ||
} | ||
} | ||
|
||
} |