Skip to content

Commit

Permalink
chore: TimeGeneratorSpec could fail on millisecond boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Jul 20, 2023
1 parent bf66443 commit 3cc5e9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ data class TimeGenerator @JvmOverloads constructor(
return if (!format.isNullOrEmpty()) {
time.format(DateTimeFormatter.ofPattern(format))
} else {
time.format(DateTimeFormatter.ISO_LOCAL_TIME)
time.format(DateTimeFormatter.ofPattern("HH:mm:ss"))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import java.time.LocalDate
import java.time.LocalTime
import java.time.OffsetDateTime
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter

class TimeGeneratorSpec extends Specification {

Expand All @@ -31,6 +32,7 @@ class TimeGeneratorSpec extends Specification {
def base = baseTime.atOffset(ZoneOffset.ofHours(11)).atDate(LocalDate.now())

expect:
TimeGenerator.@Companion.fromJson(json).generate([baseTime: base], null) == baseTime.toString()
TimeGenerator.@Companion.fromJson(json).generate([baseTime: base], null) ==
baseTime.format(DateTimeFormatter.ofPattern("HH:mm:ss"))
}
}

0 comments on commit 3cc5e9b

Please sign in to comment.