Skip to content

Commit

Permalink
robstoll#481 fixed types problem, extended KDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
rkiselev committed Aug 8, 2020
1 parent 054f718 commit ef88590
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.isEqual(

/**
* Expects that the subject of the assertion (a [ChronoLocalDateTime])
* is before the [expected] [String].
* is before the [expected] [LocalDateTime] given as [String] in (modified) ISO 8601 format.
* The string will be converted to a LocalDateTime according to ISO 8601 but with a slight deviation.
* The alternative notation (e.g. 20200401120001 instead of 2020-04-01T12:00:01) is not supported and we accept a
* date without time in which case 00:00:00 is used. Following the supported formats from the longest to the shortest:
* yyyy-mm-ddThh:mm:ss.sss (up to 9 digits for nanoseconds)
* yyyy-mm-ddThh:mm:ss
* yyyy-mm-ddThh:mm
* yyyy-mm-dd
*
* @return An [Expect] for the current subject of the assertion.
* @throws AssertionError Might throw an [AssertionError] if the assertion made is not correct.
Expand All @@ -90,7 +97,14 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.isBefore(

/**
* Expects that the subject of the assertion (a [ChronoLocalDateTime])
* is before or equal the [expected] [String].
* is before the [expected] [LocalDateTime] given as [String] in (modified) ISO 8601 format.
* The string will be converted to a LocalDateTime according to ISO 8601 but with a slight deviation.
* The alternative notation (e.g. 20200401120001 instead of 2020-04-01T12:00:01) is not supported and we accept a
* date without time in which case 00:00:00 is used. Following the supported formats from the longest to the shortest:
* yyyy-mm-ddThh:mm:ss.sss (up to 9 digits for nanoseconds)
* yyyy-mm-ddThh:mm:ss
* yyyy-mm-ddThh:mm
* yyyy-mm-dd
*
* @return An [Expect] for the current subject of the assertion.
* @throws AssertionError Might throw an [AssertionError] if the assertion made is not correct.
Expand All @@ -103,7 +117,14 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.isBeforeOrEqual(

/**
* Expects that the subject of the assertion (a [ChronoLocalDateTime])
* is after the [expected] [String].
* is before the [expected] [LocalDateTime] given as [String] in (modified) ISO 8601 format.
* The string will be converted to a LocalDateTime according to ISO 8601 but with a slight deviation.
* The alternative notation (e.g. 20200401120001 instead of 2020-04-01T12:00:01) is not supported and we accept a date
* without time in which case 00:00:00 is used. Following the supported formats from the longest to the shortest:
* yyyy-mm-ddThh:mm:ss.sss (up to 9 digits for nanoseconds)
* yyyy-mm-ddThh:mm:ss
* yyyy-mm-ddThh:mm
* yyyy-mm-dd
*
* @return An [Expect] for the current subject of the assertion.
* @throws AssertionError Might throw an [AssertionError] if the assertion made is not correct.
Expand All @@ -116,7 +137,14 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.isAfter(

/**
* Expects that the subject of the assertion (a [ChronoLocalDateTime])
* is after or equal the [expected] [String].
* is before the [expected] [LocalDateTime] given as [String] in (modified) ISO 8601 format.
* The string will be converted to a LocalDateTime according to ISO 8601 but with a slight deviation.
* The alternative notation (e.g. 20200401120001 instead of 2020-04-01T12:00:01) is not supported and we accept a date
* without time in which case 00:00:00 is used. Following the supported formats from the longest to the shortest:
* yyyy-mm-ddThh:mm:ss.sss (up to 9 digits for nanoseconds)
* yyyy-mm-ddThh:mm:ss
* yyyy-mm-ddThh:mm
* yyyy-mm-dd
*
* @return An [Expect] for the current subject of the assertion.
* @throws AssertionError Might throw an [AssertionError] if the assertion made is not correct.
Expand All @@ -129,7 +157,14 @@ fun <T : ChronoLocalDateTime<out ChronoLocalDate>> Expect<T>.isAfterOrEqual(

/**
* Expects that the subject of the assertion (a [ChronoLocalDateTime])
* is equal to the [expected] [String].
* is before the [expected] [LocalDateTime] given as [String] in (modified) ISO 8601 format.
* The string will be converted to a LocalDateTime according to ISO 8601 but with a slight deviation.
* The alternative notation (e.g. 20200401120001 instead of 2020-04-01T12:00:01) is not supported and we accept a date
* without time in which case 00:00:00 is used. Following the supported formats from the longest to the shortest:
* yyyy-mm-ddThh:mm:ss.sss (up to 9 digits for nanoseconds)
* yyyy-mm-ddThh:mm:ss
* yyyy-mm-ddThh:mm
* yyyy-mm-dd
*
* @return An [Expect] for the current subject of the assertion.
* @throws AssertionError Might throw an [AssertionError] if the assertion made is not correct.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class ChronoLocalDateTimeAssertionSpec : Spek({
include(StringSpec)
}) {
object ChronoLocalDateTimeSpec : ch.tutteli.atrium.specs.integration.ChronoLocalDateTimeAssertionSpec(
fun1(Expect<ChronoLocalDateTime<*>>::isBefore),
fun1(Expect<ChronoLocalDateTime<*>>::isBeforeOrEqual),
fun1(Expect<ChronoLocalDateTime<*>>::isAfter),
fun1(Expect<ChronoLocalDateTime<*>>::isAfterOrEqual),
fun1(Expect<ChronoLocalDateTime<*>>::isEqual)
fun1<ChronoLocalDateTime<*>, ChronoLocalDateTime<*>>(Expect<ChronoLocalDateTime<*>>::isBefore),
fun1<ChronoLocalDateTime<*>, ChronoLocalDateTime<*>>(Expect<ChronoLocalDateTime<*>>::isBeforeOrEqual),
fun1<ChronoLocalDateTime<*>, ChronoLocalDateTime<*>>(Expect<ChronoLocalDateTime<*>>::isAfter),
fun1<ChronoLocalDateTime<*>, ChronoLocalDateTime<*>>(Expect<ChronoLocalDateTime<*>>::isAfterOrEqual),
fun1<ChronoLocalDateTime<*>, ChronoLocalDateTime<*>>(Expect<ChronoLocalDateTime<*>>::isEqual)
)

object StringSpec : ch.tutteli.atrium.specs.integration.ChronoLocalDateTimeAssertionSpec(
Expand Down Expand Up @@ -62,7 +62,6 @@ class ChronoLocalDateTimeAssertionSpec : Spek({
expect.isEqual(expected.format(DateTimeFormatter.ISO_DATE_TIME))
}


@Suppress("unused", "UNUSED_VALUE")
private fun ambiguityTest() {
val chronoLocalDateTime: ChronoLocalDateTime<*> = notImplemented()
Expand Down

0 comments on commit ef88590

Please sign in to comment.