|
3 | 3 | import org.junit.Test; |
4 | 4 |
|
5 | 5 | import java.io.IOException; |
| 6 | +import java.text.ParseException; |
| 7 | +import java.text.SimpleDateFormat; |
6 | 8 | import java.time.Instant; |
7 | 9 | import java.time.LocalDate; |
8 | 10 | import java.time.ZoneOffset; |
9 | 11 | import java.time.format.DateTimeFormatter; |
10 | 12 | import java.util.Arrays; |
11 | 13 | import java.util.Collections; |
| 14 | +import java.util.Date; |
12 | 15 | import java.util.HashMap; |
13 | 16 | import java.util.List; |
14 | 17 | import java.util.Map; |
| 18 | +import java.util.TimeZone; |
15 | 19 |
|
16 | 20 | import static org.hamcrest.Matchers.*; |
17 | 21 |
|
@@ -115,11 +119,16 @@ public void listInstallations() throws IOException { |
115 | 119 | * |
116 | 120 | * @throws IOException |
117 | 121 | * Signals that an I/O exception has occurred. |
| 122 | + * @throws ParseException |
| 123 | + * Signals that a ParseException has occurred. |
118 | 124 | * |
119 | 125 | */ |
120 | 126 | @Test |
121 | | - public void listInstallationsSince() throws IOException { |
122 | | - Instant localDate = LocalDate.parse("2023-11-01", DateTimeFormatter.ISO_LOCAL_DATE) |
| 127 | + public void listInstallationsSince() throws IOException, ParseException { |
| 128 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| 129 | + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); |
| 130 | + Date localDate = simpleDateFormat.parse("2023-11-01"); |
| 131 | + Instant localInstant = LocalDate.parse("2023-11-01", DateTimeFormatter.ISO_LOCAL_DATE) |
123 | 132 | .atStartOfDay() |
124 | 133 | .toInstant(ZoneOffset.UTC); |
125 | 134 | GHApp app = gitHub.getApp(); |
@@ -293,7 +302,7 @@ private void testAppInstallation(GHAppInstallation appInstallation) throws IOExc |
293 | 302 |
|
294 | 303 | List<GHEvent> events = Arrays.asList(GHEvent.PULL_REQUEST, GHEvent.PUSH); |
295 | 304 | assertThat(appInstallation.getEvents(), containsInAnyOrder(events.toArray(new GHEvent[0]))); |
296 | | - assertThat(appInstallation.getCreatedAt(), is(GitHubClient.parseInstant("2019-07-04T01:19:36.000Z"))); |
| 305 | + assertThat(appInstallation.getCreatedAt(), is(GitHubClient.parseDate("2019-07-04T01:19:36.000Z").toInstant())); |
297 | 306 | assertThat(appInstallation.getUpdatedAt(), is(GitHubClient.parseInstant("2019-07-30T22:48:09.000Z"))); |
298 | 307 | assertThat(appInstallation.getSingleFileName(), nullValue()); |
299 | 308 | } |
|
0 commit comments