public class LocaltimeKt
| Modifier and Type | Method and Description |
|---|---|
static Matcher<java.time.LocalTime> |
after(java.time.LocalTime time)
Matcher that compares two LocalTimes and checks whether one is after the other
|
static Matcher<java.time.LocalTime> |
before(java.time.LocalTime time)
Matcher that compares two LocalTimes and checks whether one is before the other
|
static Matcher<java.time.LocalTime> |
between(java.time.LocalTime a,
java.time.LocalTime b)
Matcher that checks if LocalTime is between two other LocalTimes
|
static Matcher<java.time.LocalTime> |
haveSameHours(java.time.LocalTime time)
Matcher that compares hours of LocalTimes
|
static Matcher<java.time.LocalTime> |
haveSameMinutes(java.time.LocalTime time)
Matcher that compares minutes of LocalTimes
|
static Matcher<java.time.LocalTime> |
haveSameNanos(java.time.LocalTime time)
Matcher that compares nanos of LocalTimes
|
static Matcher<java.time.LocalTime> |
haveSameSeconds(java.time.LocalTime time)
Matcher that compares seconds of LocalTimes
|
static void |
shouldBeAfter(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that this is after time
|
static void |
shouldBeBefore(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that this is before time
|
static void |
shouldBeBetween(java.time.LocalTime $receiver,
java.time.LocalTime a,
java.time.LocalTime b)
Asserts that this is between a and b
|
static void |
shouldHaveSameHoursAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that hours in this time are the same as time's hours
|
static void |
shouldHaveSameMinutesAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that minutes in this time are the same as time's minutes
|
static void |
shouldHaveSameNanosAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that nanos in this time are the same as time's nanos
|
static void |
shouldHaveSameSecondsAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that seconds in this time are the same as time's seconds
|
static void |
shouldNotBeAfter(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that this is NOT after time
|
static void |
shouldNotBeBefore(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that this is NOT before time
|
static void |
shouldNotBeBetween(java.time.LocalTime $receiver,
java.time.LocalTime a,
java.time.LocalTime b)
Asserts that this is NOT between a and b
|
static void |
shouldNotHaveSameHoursAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that hours in this time are NOT the same as time's hours
|
static void |
shouldNotHaveSameMinutesAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that minutes in this time are NOT the same as time's minutes
|
static void |
shouldNotHaveSameNanosAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that nanos in this time are NOT the same as time's nanos
|
static void |
shouldNotHaveSameSecondsAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that seconds in this time are NOT the same as time's seconds
|
public static void shouldHaveSameHoursAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that hours in this time are the same as time's hours
Verifies that hours in this time are the same as time's hours, ignoring any other fields. For example, 16:59:59:7777 has the same hours as 16:01:02:0001, and this assertion should pass for this comparison
Opposite of LocaltimeKt.shouldNotHaveSameHoursAs
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(23, 1, 2, 3333)
firstTime shouldHaveSameHoursAs secondTime // Assertion passes
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(16, 59, 30, 1000)
firstTime shouldHaveSameHoursAs secondTime // Assertion fails, 23 != 16
LocaltimeKt.shouldNotHaveSameHoursAspublic static void shouldNotHaveSameHoursAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that hours in this time are NOT the same as time's hours
Verifies that hours in this time aren't the same as time's hours, ignoring any other fields. For example, 16:59:59:7777 doesn't have the same hours as 16:01:02:0001, and this assertion should pass for this comparison
Opposite of LocaltimeKt.shouldNotHaveSameHoursAs
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(20, 59, 30, 1000)
firstTime shouldNotHaveSameHoursAs secondTime // Assertion passes
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(23, 30, 25, 2222)
firstTime shouldNotHaveSameHoursAs secondTime // Assertion fails, 23 == 23
LocaltimeKt.shouldNotHaveSameHoursAspublic static Matcher<java.time.LocalTime> haveSameHours(java.time.LocalTime time)
Matcher that compares hours of LocalTimes
Verifies that two times have exactly the same hours, ignoring any other fields. For example, 23:59:30:9999 has the same hours as 23:01:02:3333, and the matcher will have a positive result for this comparison
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(23, 1, 2, 3333)
firstTime should haveSameHours(secondTime) // Assertion passes
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(16, 59, 30, 1000)
firstTime shouldNot haveSameHours(secondTime) // Assertion passes
public static void shouldHaveSameMinutesAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that minutes in this time are the same as time's minutes
Verifies that minutes in this time are the same as time's minutes, ignoring any other fields. For example, 1:59:03:7777 has the same minutes as 2:59:22:3333, and this assertion should pass for this comparison
Opposite of LocaltimeKt.shouldNotHaveSameMinutesAs
val firstTime = LocalTime.of(13, 59, 30, 1000)
val secondTime = LocalTime.of(17, 59, 22, 3333)
firstTime shouldHaveSameMinutesAs secondTime // Assertion passes
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(23, 1, 30, 1000)
firstTime shouldHaveSameMinutesAs secondTime // Assertion fails, 59 != 1
LocaltimeKt.shouldNotHaveSameMinutesAspublic static void shouldNotHaveSameMinutesAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that minutes in this time are NOT the same as time's minutes
Verifies that minutes in this time aren't the same as time's minutes, ignoring any other fields. For example, 16:59:02:1111 doesn't have the same minutes as 16:01:02:1111, and this assertion should pass for this comparison
Opposite of LocaltimeKt.shouldHaveSameMinutesAs
val firstTime = LocalTime.of(22, 59, 30, 1000)
val secondTime = LocalTime.of(11, 59, 22, 3333)
firstTime shouldNotHaveSameMinutesAs secondTime // Assertion passes
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(22, 59, 35, 2222)
firstTime shouldNotHaveSameMinutesAs secondTime // Assertion fails, 59 == 59
LocaltimeKt.shouldHaveSameMinutesAspublic static Matcher<java.time.LocalTime> haveSameMinutes(java.time.LocalTime time)
Matcher that compares minutes of LocalTimes
Verifies that two times have exactly the same minutes, ignoring any other fields. For example, 23:59:30:9999 has the same minutes as 12:59:02:3333, and the matcher will have a positive result for this comparison
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(12, 59, 2, 3333)
firstTime should haveSameMinutes(secondTime) // Assertion passes
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(23, 20, 30, 1000)
firstTime shouldNot haveSameMinutes(secondTime) // Assertion passes
public static void shouldHaveSameSecondsAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that seconds in this time are the same as time's seconds
Verifies that seconds in this time are the same as time's seconds, ignoring any other fields. For example, 1:59:03:7777 has the same seconds as 2:33:03:3333, and this assertion should pass for this comparison
Opposite of LocaltimeKt.shouldNotHaveSameSecondsAs
val firstTime = LocalTime.of(13, 59, 30, 1000)
val secondTime = LocalTime.of(17, 22, 30, 3333)
firstTime shouldHaveSameSecondsAs secondTime // Assertion passes
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(23, 59, 25, 1000)
firstTime shouldHaveSameSecondsAs secondTime // Assertion fails, 30 != 25
LocaltimeKt.shouldNotHaveSameSecondsAspublic static void shouldNotHaveSameSecondsAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that seconds in this time are NOT the same as time's seconds
Verifies that seconds in this time aren't the same as time's seconds, ignoring any other fields. For example, 16:59:05:1111 doesn't have the same seconds as 16:59:02:1111, and this assertion should pass for this comparison
Opposite of LocaltimeKt.shouldHaveSameSecondsAs
val firstTime = LocalTime.of(22, 59, 30, 1000)
val secondTime = LocalTime.of(22, 59, 21, 1000)
firstTime shouldNotHaveSameSecondsAs secondTime // Assertion passes
val firstTime = LocalTime.of(23, 40, 30, 1000)
val secondTime = LocalTime.of(11, 45, 30, 2222)
firstTime shouldNotHaveSameSecondsAs secondTime // Assertion fails, 30 == 30
LocaltimeKt.shouldHaveSameSecondsAspublic static Matcher<java.time.LocalTime> haveSameSeconds(java.time.LocalTime time)
Matcher that compares seconds of LocalTimes
Verifies that two times have exactly the same seconds, ignoring any other fields. For example, 23:17:30:9999 has the same seconds as 12:59:30:3333, and the matcher will have a positive result for this comparison
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(12, 27, 30, 3333)
firstTime should haveSameSeconds(secondTime) // Assertion passes
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(23, 59, 45, 1000)
firstTime shouldNot haveSameSeconds(secondTime) // Assertion passes
public static void shouldHaveSameNanosAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that nanos in this time are the same as time's nanos
Verifies that nanos in this time are the same as time's nanos, ignoring any other fields. For example, 1:59:15:7777 has the same nanos as 2:33:03:7777, and this assertion should pass for this comparison
Opposite of LocaltimeKt.shouldNotHaveSameNanosAs
val firstTime = LocalTime.of(13, 59, 45, 1000)
val nanoTime = LocalTime.of(17, 22, 30, 1000)
firstTime shouldHaveSameNanosAs nanoTime // Assertion passes
val firstTime = LocalTime.of(23, 59, 30, 1000)
val nanoTime = LocalTime.of(23, 59, 30, 3333)
firstTime shouldHaveSameNanosAs nanoTime // Assertion fails, 1000 != 3333
LocaltimeKt.shouldNotHaveSameNanosAspublic static void shouldNotHaveSameNanosAs(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that nanos in this time are NOT the same as time's nanos
Verifies that nanos in this time aren't the same as time's nanos, ignoring any other fields. For example, 16:59:05:2222 doesn't have the same nanos as 16:59:05:1111, and this assertion should pass for this comparison
Opposite of LocaltimeKt.shouldHaveSameNanosAs
val firstTime = LocalTime.of(22, 59, 30, 1000)
val secondTime = LocalTime.of(22, 59, 30, 3333)
firstTime shouldNotHaveSameNanosAs secondTime // Assertion passes
val firstTime = LocalTime.of(23, 40, 30, 1000)
val secondTime = LocalTime.of(12, 17, 59, 1000)
firstTime shouldNotHaveSameNanosAs secondTime // Assertion fails, 1000 == 1000
LocaltimeKt.shouldHaveSameNanosAspublic static Matcher<java.time.LocalTime> haveSameNanos(java.time.LocalTime time)
Matcher that compares nanos of LocalTimes
Verifies that two times have exactly the same nanos, ignoring any other fields. For example, 23:17:30:9999 has the same nanos as 12:59:30:3333, and the matcher will have a positive result for this comparison
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(12, 27, 05, 1000)
firstTime should haveSameNanos(secondTime) // Assertion passes
val firstTime = LocalTime.of(23, 59, 30, 1000)
val secondTime = LocalTime.of(23, 59, 30, 2222)
firstTime shouldNot haveSameNanos(secondTime) // Assertion passes
public static void shouldBeBefore(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that this is before time
Verifies that this is before time, comparing hours, minutes, seconds, nanos. For example, 12:30:59:2222 is before 12:30:59:3333, and this assertion should pass for this comparison.
Opposite of LocaltimeKt.shouldNotBeBefore
val firstTime = LocalTime.of(12:30:59:2222)
val secondTime = LocalTime.of(12:30:59:3333)
firstTime shouldBeBefore secondTime // Assertion passes
val firstTime = LocalTime.of(14:30:59:2222)
val secondTime = LocalTime.of(12:30:59:2222)
firstTime shouldBeBefore secondTime // Assertion fails, 14:30:59:2222 is not before 12:30:59:2222 as expected.
public static void shouldNotBeBefore(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that this is NOT before time
Verifies that this is not before time, comparing hours, minutes, seconds, nanos. For example, 12:30:59:2222 is not before 12:30:59:1111, and this assertion should pass for this comparison.
Opposite of LocaltimeKt.shouldBeBefore
val firstTime = LocalTime.of(12:30:59:2222)
val secondTime = LocalTime.of(12:30:59:1111)
firstTime shouldNotBeBefore secondTime // Assertion passes
val firstTime = LocalTime.of(12:30:59:2222)
val secondTime = LocalTime.of(12:30:59:3333)
firstTime shouldNotBeBefore secondTime // Assertion fails, 12:30:59:2222 is before 12:30:59:3333, and we expected the opposite.
public static Matcher<java.time.LocalTime> before(java.time.LocalTime time)
Matcher that compares two LocalTimes and checks whether one is before the other
Verifies that two LocalTimes occurs in a certain order, checking that one happened before the other. For example, 12:30:59:2222 is before 12:30:59:3333, and the matcher will have a positive result for this comparison
val firstTime = LocalTime.of(12:30:59:2222)
val secondTime = LocalTime.of(12:30:59:3333)
firstTime shouldBe before(secondTime) // Assertion passes
val firstTime = LocalTime.of(12:30:59:2222)
val secondTime = LocalTime.of(12:30:59:1111)
firstTime shouldNotBe before(secondTime) // Assertion passes
public static void shouldBeAfter(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that this is after time
Verifies that this is after time, comparing hours, minutes, seconds, nanos. For example, 12:30:59:2222 is after 10:22:59:2222, and this assertion should pass for this comparison.
Opposite of LocaltimeKt.shouldNotBeAfter
val firstTime = LocalTime.of(12, 30, 59, 1111)
val secondTime = LocalTime.of(11, 30, 59, 1111)
firstTime shouldBeAfter secondTime // Assertion passes
val firstTime = LocalTime.of(12, 30, 59, 1111)
val secondTime = LocalTime.of(12, 50, 59, 1111)
firstTime shouldBeAfter secondTime // Assertion fails, firstTime is NOT after secondTime
public static void shouldNotBeAfter(java.time.LocalTime $receiver,
java.time.LocalTime time)
Asserts that this is NOT after time
Verifies that this is not after time, comparing hours, minutes, seconds, nanos. For example, 12:30:59:2222 is not after 12:30:59:3333, and this assertion should pass for this comparison.
Opposite of LocaltimeKt.shouldBeAfter
val firstTime = LocalTime.of(12:30:59:2222)
val secondTime = LocalTime.of(12:30:59:3333)
firstTime shouldNotBeAfter secondTime // Assertion passes
val firstTime = LocalTime.of(12:30:59:2222)
val secondTime = LocalTime.of(12:30:59:1111)
firstTime shouldNotBeAfter secondTime // Assertion fails, first time IS after secondTime
public static Matcher<java.time.LocalTime> after(java.time.LocalTime time)
Matcher that compares two LocalTimes and checks whether one is after the other
Verifies that two LocalTimes occurs in a certain order, checking that one happened after the other. For example, 12:30:59:2222 is after 12:30:59:1111, and the matcher will have a positive result for this comparison
val firstTime = LocalTime.of(12:30:59:2222)
val secondTime = LocalTime.of(09:30:59:2222)
firstTime shouldBe after(secondTime ) // Assertion passes
val firstTime = LocalTime.of(12:30:59:2222)
val secondTime = LocalTime.of(16:30:59:2222)
firstTime shouldNotBe after(secondTime) // Assertion passes
public static void shouldBeBetween(java.time.LocalTime $receiver,
java.time.LocalTime a,
java.time.LocalTime b)
Asserts that this is between a and b
Verifies that this is after a and before b, comparing hours, minutes, seconds, nanos.
Opposite of LocaltimeKt.shouldNotBeBetween
val time = LocalTime.of(12, 30, 59, 1111)
val firstTime = LocalTime.of(11, 0, 0, 0)
val secondTime = LocalTime.of(12, 31, 0, 0)
date.shouldBeBetween(firstTime, secondTime) // Assertion passes
val time = LocalTime.of(12, 30, 59, 1111)
val firstTime = LocalTime.of(12, 30, 59, 2222)
val secondTime = LocalTime.of(12, 30, 59, 3333)
date.shouldBeBetween(firstTime, secondTime) // Assertion fails, time is NOT between firstTime and secondTime
public static void shouldNotBeBetween(java.time.LocalTime $receiver,
java.time.LocalTime a,
java.time.LocalTime b)
Asserts that this is NOT between a and b
Verifies that this is not after a and before b, comparing hours, minutes, seconds, nanos.
Opposite of LocaltimeKt.shouldBeBetween
val time = LocalTime.of(12, 30, 59, 1111)
val firstTime = LocalTime.of(12, 30, 59, 2222)
val secondTime = LocalTime.of(12, 30, 59, 3333)
time.shouldNotBeBetween(firstTime, secondTime) // Assertion passes
val time = LocalTime.of(12, 30, 59, 1111)
val firstTime = LocalTime.of(11, 0, 0, 0)
val secondTime = LocalTime.of(12, 31, 0, 0)
time.shouldNotBeBetween(firstTime, secondTime) // Assertion fails, time IS between firstTime and secondTime
public static Matcher<java.time.LocalTime> between(java.time.LocalTime a, java.time.LocalTime b)
Matcher that checks if LocalTime is between two other LocalTimes
Verifies that LocalTime is after the first LocalTime and before the second LocalTime For example, 12:30:59:2222 is between 12:30:59:1111 and 12:30:59:3333, and the matcher will have a positive result for this comparison
val time = LocalTime.of(12, 30, 59, 1111)
val firstTime = LocalTime.of(11, 0, 0, 0)
val secondTime = LocalTime.of(12, 31, 0, 0)
time shouldBe after(firstTime, secondTime) // Assertion passes
val time = LocalTime.of(12, 30, 59, 1111)
val firstTime = LocalTime.of(12, 30, 59, 2222)
val secondTime = LocalTime.of(12, 30, 59, 3333)
time shouldNotBe between(firstTime, secondTime) // Assertion passes