Github user dsmiley commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/428#discussion_r207645614
--- Diff:
solr/core/src/test/org/apache/solr/update/processor/ParsingFieldUpdateProcessorsTest.java
---
@@ -116,12 +118,12 @@ public void
testParseDateNonUTCdefaultTimeZoneRoundTrip() throws Exception {
("parse-date-non-UTC-defaultTimeZone", doc(f("id", "99"),
f("dateUTC_dt", dateStringUTC),
f("dateNoTimeZone_dt",
dateStringNoTimeZone)));
assertNotNull(d);
- String pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
- DateTimeFormatter dateTimeFormatterUTC =
DateTimeFormat.forPattern(pattern);
- DateTime dateTimeUTC =
dateTimeFormatterUTC.parseDateTime(dateStringUTC);
+ String pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ";
+ DateTimeFormatter UTCForamatter = DateTimeFormatter.ofPattern(pattern,
Locale.ROOT).withZone(ZoneId.of("America/New_York"));
+ OffsetDateTime dateTimeOffsetUTC = OffsetDateTime.parse(dateStringUTC,
UTCForamatter);
assertTrue(d.getFieldValue("dateUTC_dt") instanceof Date);
assertTrue(d.getFieldValue("dateNoTimeZone_dt") instanceof Date);
- assertEquals(dateTimeUTC.getMillis(), ((Date)
d.getFieldValue("dateUTC_dt")).getTime());
+ assertEquals(dateTimeOffsetUTC.toInstant().toEpochMilli(), ((Date)
d.getFieldValue("dateUTC_dt")).getTime());
--- End diff --
I stared at this test for awhile and came to the conclusion that the
UTCFormatter related stuff is unnecessary (those 3 lines above), and so is this
assertEquals line. You can remove them. Those several lines were internal
confusing jirations that didn't actually really test anything other than
demonstrate how one can use java.time (formerly joda). The real meat of this
test IMO is the assertQ with the string constants, which is good.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]