public class LocaldatetimeKt
| Modifier and Type | Method and Description |
|---|---|
static Matcher<java.time.LocalDateTime> |
beInToday()
Matcher that checks if a LocalDateTime has a Date component of today
|
static Matcher<java.time.LocalDate> |
beToday()
Matcher that checks if a LocalDate is today
|
static void |
shouldBeToday(java.time.LocalDateTime $receiver)
Asserts that the LocalDateTime has a date component of today
|
static void |
shouldBeToday(java.time.LocalDate $receiver)
Asserts that the LocalDate is today
|
static void |
shouldNotBeToday(java.time.LocalDateTime $receiver)
Asserts that the LocalDateTime does not have a date component of today
|
static void |
shouldNotBeToday(java.time.LocalDate $receiver)
Asserts that the LocalDate is not today
|
public static Matcher<java.time.LocalDateTime> beInToday()
Matcher that checks if a LocalDateTime has a Date component of today
It does this by checking it against LocalDate.now(), so if you are not using constant now listeners, using this might fail if test run exactly on a date change.
val date = LocalDateTime.now()
date should beInToday() // Assertion passes
val date = LocalDateTime.of(2018, Month.APRIL, 1, 3, 5)
date should beInToday() // Assertion fails
public static Matcher<java.time.LocalDate> beToday()
Matcher that checks if a LocalDate is today
It does this by checking it against LocalDate.now(), so if you are not using constant now listeners, using this might fail if test run exactly on a date change.
val date = LocalDate.now()
date should beToday() // Assertion passes
val date = LocalDate.of(2018,1,1)
date should beToday() // Assertion fails
public static void shouldBeToday(java.time.LocalDateTime $receiver)
Asserts that the LocalDateTime has a date component of today
LocalDateTime.now().shouldBeToday() // Assertion passes
public static void shouldBeToday(java.time.LocalDate $receiver)
Asserts that the LocalDate is today
LocalDate.now().shouldBeToday() // Assertion passes
public static void shouldNotBeToday(java.time.LocalDateTime $receiver)
Asserts that the LocalDateTime does not have a date component of today
LocalDateTime.of(2009, Month.APRIL, 2,2,2).shouldNotBeToday() // Assertion passes
public static void shouldNotBeToday(java.time.LocalDate $receiver)
Asserts that the LocalDate is not today
LocalDate.of(2009, Month.APRIL, 2).shouldNotBeToday() // Assertion passes