You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.4 KiB
55 lines
1.4 KiB
1 year ago
|
import spock.lang.*
|
||
|
|
||
|
import java.time.LocalDate
|
||
|
import java.time.LocalDateTime
|
||
|
import java.time.Month
|
||
|
|
||
|
class GigasecondSpec extends Specification {
|
||
|
|
||
|
def "Date only specification of time"() {
|
||
|
expect:
|
||
|
Gigasecond.add(moment) == expected
|
||
|
|
||
|
where:
|
||
|
moment = LocalDate.of(2011, Month.APRIL, 25)
|
||
|
expected = LocalDateTime.of(2043, Month.JANUARY, 1, 1, 46, 40)
|
||
|
}
|
||
|
|
||
|
def "Second test for date only specification of time"() {
|
||
|
expect:
|
||
|
Gigasecond.add(moment) == expected
|
||
|
|
||
|
where:
|
||
|
moment = LocalDate.of(1977, Month.JUNE, 13)
|
||
|
expected = LocalDateTime.of(2009, Month.FEBRUARY, 19, 1, 46, 40)
|
||
|
}
|
||
|
|
||
|
def "Third test for date only specification of time"() {
|
||
|
expect:
|
||
|
Gigasecond.add(moment) == expected
|
||
|
|
||
|
where:
|
||
|
moment = LocalDate.of(1959, Month.JULY, 19)
|
||
|
expected = LocalDateTime.of(1991, Month.MARCH, 27, 1, 46, 40)
|
||
|
}
|
||
|
|
||
|
def "Full time specified"() {
|
||
|
expect:
|
||
|
Gigasecond.add(moment) == expected
|
||
|
|
||
|
where:
|
||
|
moment = LocalDateTime.of(2015, Month.JANUARY, 24, 22, 0, 0)
|
||
|
expected = LocalDateTime.of(2046, Month.OCTOBER, 2, 23, 46, 40)
|
||
|
}
|
||
|
|
||
|
def "Full time with day roll-over"() {
|
||
|
expect:
|
||
|
Gigasecond.add(moment) == expected
|
||
|
|
||
|
where:
|
||
|
moment = LocalDateTime.of(2015, Month.JANUARY, 24, 23, 59, 59)
|
||
|
expected = LocalDateTime.of(2046, Month.OCTOBER, 3, 1, 46, 39)
|
||
|
}
|
||
|
|
||
|
}
|