Skip to content

Commit f33d725

Browse files
committed
GitHubMilestoneApiTests due_on Uses LocalDate
`GitHubMilestoneApiTests` uses `Instant.now()` for `due_on`. Since `Instant.now()` is UTC time based, `isMilestoneDueTodayWhenDueTodayThenTrue` fails when the computer that runs the test is not the same day as it is in UTC time. To fix it, `due_on` should be set to an `Instant` based upon the timezone of the current computer. Closes gh-11706
1 parent db74e9d commit f33d725

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

buildSrc/src/test/java/org/springframework/gradle/github/milestones/GitHubMilestoneApiTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.time.Instant;
55
import java.time.LocalDate;
66
import java.time.LocalTime;
7+
import java.time.ZoneId;
78
import java.util.concurrent.TimeUnit;
89

910
import okhttp3.mockwebserver.MockResponse;
@@ -636,7 +637,7 @@ public void isMilestoneDueTodayWhenDueTodayThenTrue() throws Exception {
636637
" \"state\":\"open\",\n" +
637638
" \"created_at\":\"2020-09-16T13:28:03Z\",\n" +
638639
" \"updated_at\":\"2021-04-06T23:47:10Z\",\n" +
639-
" \"due_on\":\"" + Instant.now().toString() + "\",\n" +
640+
" \"due_on\":\"" + LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant().toString() + "\",\n" +
640641
" \"closed_at\":null\n" +
641642
" }\n" +
642643
"]";

0 commit comments

Comments
 (0)