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
This commit is contained in:
Rob Winch 2022-08-15 13:01:58 -05:00
parent db74e9d128
commit f33d7253b6
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import java.nio.charset.Charset;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.ZoneId;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockResponse;
@ -636,7 +637,7 @@ public class GitHubMilestoneApiTests {
" \"state\":\"open\",\n" + " \"state\":\"open\",\n" +
" \"created_at\":\"2020-09-16T13:28:03Z\",\n" + " \"created_at\":\"2020-09-16T13:28:03Z\",\n" +
" \"updated_at\":\"2021-04-06T23:47:10Z\",\n" + " \"updated_at\":\"2021-04-06T23:47:10Z\",\n" +
" \"due_on\":\"" + Instant.now().toString() + "\",\n" + " \"due_on\":\"" + LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant().toString() + "\",\n" +
" \"closed_at\":null\n" + " \"closed_at\":null\n" +
" }\n" + " }\n" +
"]"; "]";