|
19 | 19 | package org.elasticsearch.common.rounding;
|
20 | 20 |
|
21 | 21 | import org.elasticsearch.test.ESTestCase;
|
22 |
| -import org.joda.time.DateTimeZone; |
23 |
| - |
24 |
| -import java.time.Instant; |
25 |
| -import java.time.ZoneId; |
26 |
| -import java.time.ZonedDateTime; |
27 | 22 |
|
28 | 23 | import static org.elasticsearch.common.rounding.DateTimeUnit.DAY_OF_MONTH;
|
29 | 24 | import static org.elasticsearch.common.rounding.DateTimeUnit.HOUR_OF_DAY;
|
|
33 | 28 | import static org.elasticsearch.common.rounding.DateTimeUnit.SECOND_OF_MINUTE;
|
34 | 29 | import static org.elasticsearch.common.rounding.DateTimeUnit.WEEK_OF_WEEKYEAR;
|
35 | 30 | import static org.elasticsearch.common.rounding.DateTimeUnit.YEAR_OF_CENTURY;
|
36 |
| -import static org.hamcrest.Matchers.is; |
37 | 31 |
|
38 | 32 | public class DateTimeUnitTests extends ESTestCase {
|
39 | 33 |
|
@@ -65,17 +59,4 @@ public void testEnumIds() {
|
65 | 59 | assertEquals(8, SECOND_OF_MINUTE.id());
|
66 | 60 | assertEquals(SECOND_OF_MINUTE, DateTimeUnit.resolve((byte) 8));
|
67 | 61 | }
|
68 |
| - |
69 |
| - public void testConversion() { |
70 |
| - long millis = randomLongBetween(0, Instant.now().toEpochMilli()); |
71 |
| - DateTimeZone zone = randomDateTimeZone(); |
72 |
| - ZoneId zoneId = zone.toTimeZone().toZoneId(); |
73 |
| - |
74 |
| - int offsetSeconds = zoneId.getRules().getOffset(Instant.ofEpochMilli(millis)).getTotalSeconds(); |
75 |
| - long parsedMillisJavaTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), zoneId) |
76 |
| - .minusSeconds(offsetSeconds).toInstant().toEpochMilli(); |
77 |
| - |
78 |
| - long parsedMillisJodaTime = zone.convertLocalToUTC(millis, true); |
79 |
| - assertThat(parsedMillisJavaTime, is(parsedMillisJodaTime)); |
80 |
| - } |
81 | 62 | }
|
0 commit comments