Last active
October 24, 2015 16:28
-
-
Save nurkiewicz/9d208003cddc57d4273e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spock.lang.Specification | |
import spock.lang.Unroll | |
import java.time.* | |
@Unroll | |
class BankSpec extends Specification { | |
final ZoneId warsaw = ZoneId.of("Europe/Warsaw") | |
def 'should calculate downtime also in DST'() { | |
given: | |
LocalDate date = LocalDate.of(2015, Month.OCTOBER, day) | |
ZonedDateTime from = ZonedDateTime.of(date, LocalTime.of(2, 30), warsaw) | |
ZonedDateTime to = ZonedDateTime.of(date, LocalTime.of(3, 30), warsaw) | |
when: | |
Duration duration = Duration.between(from, to) | |
then: | |
duration == Duration.ofHours(expectedHours) | |
where: | |
day | expectedHours | |
24 | 1 | |
25 | 2 | |
26 | 1 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment