|
20 | 20 | import java.time.ZoneId;
|
21 | 21 | import java.time.ZonedDateTime;
|
22 | 22 | import java.util.Objects;
|
23 |
| -import java.util.TimeZone; |
24 | 23 |
|
25 | 24 | import org.eclipse.jdt.annotation.NonNullByDefault;
|
26 | 25 | import org.junit.jupiter.params.ParameterizedTest;
|
@@ -148,38 +147,37 @@ public void testOpenClosedTypeWithContactItem(boolean legacy) throws IOException
|
148 | 147 | @CsvSource({ "true", "false" })
|
149 | 148 | public void testDateTimeTypeWithDateTimeItem(boolean legacy) throws IOException {
|
150 | 149 | GenericItem item = new DateTimeItem("foo");
|
151 |
| - ZonedDateTime zdt = ZonedDateTime.parse("2016-05-01T13:46:00.050Z"); |
152 |
| - DynamoDBItem<?> dbitem = testSerializationToDTO(legacy, item, new DateTimeType(zdt.toString()), |
| 150 | + Instant instant = Instant.parse("2016-05-01T13:46:00.050Z"); |
| 151 | + DynamoDBItem<?> dbitem = testSerializationToDTO(legacy, item, new DateTimeType(instant), |
153 | 152 | "2016-05-01T13:46:00.050Z");
|
154 |
| - testAsHistoricGeneric(dbitem, item, new DateTimeType(zdt.withZoneSameInstant(ZoneId.systemDefault()))); |
| 153 | + testAsHistoricGeneric(dbitem, item, new DateTimeType(instant)); |
155 | 154 | }
|
156 | 155 |
|
157 | 156 | @ParameterizedTest
|
158 | 157 | @CsvSource({ "true", "false" })
|
159 | 158 | public void testDateTimeTypeWithStringItem(boolean legacy) throws IOException {
|
160 | 159 | GenericItem item = new StringItem("foo");
|
161 | 160 | DynamoDBItem<?> dbitem = testSerializationToDTO(legacy, item,
|
162 |
| - new DateTimeType(ZonedDateTime.parse("2016-05-01T13:46:00.050Z")), "2016-05-01T13:46:00.050Z"); |
| 161 | + new DateTimeType(Instant.parse("2016-05-01T13:46:00.050Z")), "2016-05-01T13:46:00.050Z"); |
163 | 162 | testAsHistoricGeneric(dbitem, item, new StringType("2016-05-01T13:46:00.050Z"));
|
164 | 163 | }
|
165 | 164 |
|
166 | 165 | @ParameterizedTest
|
167 | 166 | @CsvSource({ "true", "false" })
|
168 | 167 | public void testDateTimeTypeLocalWithDateTimeItem(boolean legacy) throws IOException {
|
169 | 168 | GenericItem item = new DateTimeItem("foo");
|
170 |
| - ZonedDateTime expectedZdt = Instant.ofEpochMilli(1468773487050L).atZone(ZoneId.systemDefault()); |
| 169 | + Instant expectedInstant = Instant.ofEpochMilli(1468773487050L); |
171 | 170 | DynamoDBItem<?> dbitem = testSerializationToDTO(legacy, item, new DateTimeType("2016-07-17T19:38:07.050+0300"),
|
172 | 171 | "2016-07-17T16:38:07.050Z");
|
173 |
| - testAsHistoricGeneric(dbitem, item, new DateTimeType(expectedZdt)); |
| 172 | + testAsHistoricGeneric(dbitem, item, new DateTimeType(expectedInstant)); |
174 | 173 | }
|
175 | 174 |
|
176 | 175 | @ParameterizedTest
|
177 | 176 | @CsvSource({ "true", "false" })
|
178 | 177 | public void testDateTimeTypeLocalWithStringItem(boolean legacy) throws IOException {
|
179 | 178 | GenericItem item = new StringItem("foo");
|
180 | 179 | Instant instant = Instant.ofEpochMilli(1468773487050L); // GMT: Sun, 17 Jul 2016 16:38:07.050 GMT
|
181 |
| - ZonedDateTime zdt = instant.atZone(TimeZone.getTimeZone("GMT+03:00").toZoneId()); |
182 |
| - DynamoDBItem<?> dbitem = testSerializationToDTO(legacy, item, new DateTimeType(zdt), |
| 180 | + DynamoDBItem<?> dbitem = testSerializationToDTO(legacy, item, new DateTimeType(instant), |
183 | 181 | "2016-07-17T16:38:07.050Z");
|
184 | 182 | testAsHistoricGeneric(dbitem, item, new StringType("2016-07-17T16:38:07.050Z"));
|
185 | 183 | }
|
|
0 commit comments