Skip to content

Commit

Permalink
Fix unstable iteration names in MutableClockSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
leonard84 committed Aug 30, 2024
1 parent 1a3ed09 commit 7c7d010
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions spock-specs/src/test/groovy/spock/util/time/MutableClockSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class MutableClockSpec extends Specification {
thrown(NullPointerException)
}

def "MutableClock can be adjusted with TemporalAdjuster"(TemporalAdjuster adjuster, ZonedDateTime expected) {
def "MutableClock can be adjusted with TemporalAdjuster #adjusterName"(TemporalAdjuster adjuster, ZonedDateTime expected) {
expect:
mutableClock.instant() == defaultInstant

Expand All @@ -206,14 +206,14 @@ class MutableClockSpec extends Specification {
mutableClock.instant() == expected.toInstant()

where:
adjuster | expected
TemporalAdjusters.firstDayOfMonth() | ZonedDateTime.of(2000, 6, 1, 12, 30, 30, 100, UTC)
TemporalAdjusters.firstDayOfYear() | ZonedDateTime.of(2000, 1, 1, 12, 30, 30, 100, UTC)
TemporalAdjusters.lastDayOfMonth() | ZonedDateTime.of(2000, 6, 30, 12, 30, 30, 100, UTC)
TemporalAdjusters.lastDayOfYear() | ZonedDateTime.of(2000, 12, 31, 12, 30, 30, 100, UTC)
adjuster | adjusterName | expected
TemporalAdjusters.firstDayOfMonth() | "firstDayOfMonth" | ZonedDateTime.of(2000, 6, 1, 12, 30, 30, 100, UTC)
TemporalAdjusters.firstDayOfYear() | "firstDayOfYear" | ZonedDateTime.of(2000, 1, 1, 12, 30, 30, 100, UTC)
TemporalAdjusters.lastDayOfMonth() | "lastDayOfMonth" | ZonedDateTime.of(2000, 6, 30, 12, 30, 30, 100, UTC)
TemporalAdjusters.lastDayOfYear() | "lastDayOfYear" | ZonedDateTime.of(2000, 12, 31, 12, 30, 30, 100, UTC)
}

def "MutableClock can be modified with a function"(Closure modification, Instant expected) {
def "MutableClock can be modified with a function #description"(Closure modification, Instant expected) {
expect:
mutableClock.instant() == defaultInstant

Expand All @@ -224,8 +224,8 @@ class MutableClockSpec extends Specification {
mutableClock.instant() == expected

where:
_ | modification | expected
_ | { Instant i, ZoneId z -> i.plusSeconds(1) } | defaultInstant.plusSeconds(1)
_ | { Instant i, ZoneId z -> ZonedDateTime.ofInstant(i, z).with(TemporalAdjusters.firstDayOfYear()).toInstant() } | ZonedDateTime.of(2000, 1, 1, 12, 30, 30, 100, UTC).toInstant()
description | modification | expected
'plusSeconds' | { Instant i, ZoneId z -> i.plusSeconds(1) } | defaultInstant.plusSeconds(1)
'firstDayOfYear' | { Instant i, ZoneId z -> ZonedDateTime.ofInstant(i, z).with(TemporalAdjusters.firstDayOfYear()).toInstant() } | ZonedDateTime.of(2000, 1, 1, 12, 30, 30, 100, UTC).toInstant()
}
}

0 comments on commit 7c7d010

Please sign in to comment.