diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java index f979c30b4d5..055e4d69999 100644 --- a/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java +++ b/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java @@ -343,6 +343,8 @@ public class TestBackwardsCompatibility extends LuceneTestCase { "5.4.1-nocfs", "5.5.0-cfs", "5.5.0-nocfs", + "5.5.1-cfs", + "5.5.1-nocfs", }; // TODO: on 6.0.0 release, gen the single segment indices and add here: diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/unsupported.5.5.1-cfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/unsupported.5.5.1-cfs.zip new file mode 100644 index 00000000000..9d28e67cc29 Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/index/unsupported.5.5.1-cfs.zip differ diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/unsupported.5.5.1-nocfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/unsupported.5.5.1-nocfs.zip new file mode 100644 index 00000000000..5160bc38df4 Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/index/unsupported.5.5.1-nocfs.zip differ diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/tree/DateRangePrefixTreeTest.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/tree/DateRangePrefixTreeTest.java index e8c63518ca3..d76454e6ae3 100644 --- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/tree/DateRangePrefixTreeTest.java +++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/tree/DateRangePrefixTreeTest.java @@ -17,7 +17,8 @@ package org.apache.lucene.spatial.prefix.tree; import java.text.ParseException; -import java.time.Instant; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; import java.util.Arrays; import java.util.Calendar; import java.util.GregorianCalendar; @@ -90,10 +91,24 @@ public class DateRangePrefixTreeTest extends LuceneTestCase { //test random cal.setTimeInMillis(random().nextLong()); roundTrip(cal); - //assert same toString as java.time, provided it's after the GCD - if (cal.getTimeInMillis() > ((GregorianCalendar)tree.newCal()).getGregorianChange().getTime()) { - assertEquals(Instant.ofEpochMilli(cal.getTimeInMillis()).toString(), tree.toString(cal) + 'Z'); + } + + public void testToStringISO8601() { + Calendar cal = tree.newCal(); + cal.setTimeInMillis(random().nextLong()); + // create ZonedDateTime from the calendar, then get toInstant.toString which is the ISO8601 we emulate + // note: we don't simply init off of millisEpoch because of possible GregorianChangeDate discrepancy. + int year = cal.get(Calendar.YEAR); + if (cal.get(Calendar.ERA) == 0) { // BC + year = -year + 1; } + String expectedISO8601 = + ZonedDateTime.of(year, cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH), + cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND), + cal.get(Calendar.MILLISECOND) * 1_000_000, ZoneOffset.UTC) + .toInstant().toString(); + String resultToString = tree.toString(cal) + 'Z'; + assertEquals(expectedISO8601, resultToString); } //copies from DateRangePrefixTree @@ -109,7 +124,6 @@ public class DateRangePrefixTreeTest extends LuceneTestCase { { Calendar preToStringCalClone = (Calendar) cal.clone(); calString = tree.toString(cal); - assert lastString == null || calString.length() < lastString.length(); assertEquals(preToStringCalClone, cal);//ensure toString doesn't modify cal state }