Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add appendZoneRegionId() to formatter

This handles ZoneOffset now being a ZoneId subclass
  • Loading branch information...
commit 29e9e66f9e1eea7ba75d19177fae5eb9ed745bf5 1 parent f8dbf78
@jodastephen jodastephen authored
View
82 src/main/java/javax/time/format/DateTimeFormatterBuilder.java
@@ -617,15 +617,34 @@ public DateTimeFormatterBuilder appendOffset(String pattern, String noOffsetText
//-----------------------------------------------------------------------
/**
- * Appends the time-zone ID, such as 'Europe/Paris', to the formatter.
+ * Appends the time-zone ID, such as 'Europe/Paris' or '+02:00', to the formatter.
* <p>
- * The time-zone ID will be output during a print.
+ * A {@link ZoneId} can be either a {@code ZoneOffset} or an ID of a region
+ * such as 'America/New_York'. This prints and parses both types.
* If the zone cannot be obtained then an exception will be thrown.
*
* @return this, for chaining, not null
+ * @see #appendZoneRegionId()
*/
public DateTimeFormatterBuilder appendZoneId() {
- appendInternal(new ZoneIdPrinterParser(null));
+ appendInternal(new ZoneIdPrinterParser(false));
+ return this;
+ }
+
+ /**
+ * Appends the time-zone region ID, such as 'Europe/Paris', to the formatter,
+ * printing nothing if the zone ID is a {@code ZoneOffset}.
+ * <p>
+ * A {@link ZoneId} can be either a {@code ZoneOffset} or an ID of a region
+ * such as 'America/New_York'. This only prints if the ID is a region.
+ * Both types are parsed, however the parsing of the offset is optional.
+ * If the zone cannot be obtained then an exception will be thrown.
+ *
+ * @return this, for chaining, not null
+ * @see #appendZoneId()
+ */
+ public DateTimeFormatterBuilder appendZoneRegionId() {
+ appendInternal(new ZoneIdPrinterParser(true));
return this;
}
@@ -646,8 +665,7 @@ public DateTimeFormatterBuilder appendZoneId() {
* @return this, for chaining, not null
*/
public DateTimeFormatterBuilder appendZoneText(TextStyle textStyle) {
- Objects.requireNonNull(textStyle, "textStyle");
- appendInternal(new ZoneIdPrinterParser(textStyle));
+ appendInternal(new ZoneTextPrinterParser(textStyle));
return this;
}
@@ -2414,13 +2432,13 @@ public String toString() {
/**
* Prints or parses a zone ID.
*/
- static final class ZoneIdPrinterParser implements DateTimePrinterParser {
- /** The text style to output, null means the ID. */
+ static final class ZoneTextPrinterParser implements DateTimePrinterParser {
+ // TODO: remove this as it is incomplete
+ /** The text style to output. */
private final TextStyle textStyle;
- ZoneIdPrinterParser(TextStyle textStyle) {
- // validated by caller
- this.textStyle = textStyle;
+ ZoneTextPrinterParser(TextStyle textStyle) {
+ this.textStyle = Objects.requireNonNull(textStyle, "textStyle");
}
//-----------------------------------------------------------------------
@@ -2430,12 +2448,41 @@ public boolean print(DateTimePrintContext context, StringBuilder buf) {
if (zone == null) {
return false;
}
- if (textStyle == null) {
- buf.append(zone.getId());
- } else {
- // TODO: fix getText(textStyle, context.getLocale())
- buf.append(zone.getId()); // TODO: Use symbols
+ // TODO: fix getText(textStyle, context.getLocale())
+ buf.append(zone.getId()); // TODO: Use symbols
+ return true;
+ }
+
+ @Override
+ public int parse(DateTimeParseContext context, CharSequence text, int position) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String toString() {
+ return "ZoneText(" + textStyle + ")";
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Prints or parses a zone ID.
+ */
+ static final class ZoneIdPrinterParser implements DateTimePrinterParser {
+ private final boolean regionOnly;
+
+ ZoneIdPrinterParser(boolean regionOnly) {
+ this.regionOnly = regionOnly;
+ }
+
+ //-----------------------------------------------------------------------
+ @Override
+ public boolean print(DateTimePrintContext context, StringBuilder buf) {
+ ZoneId zone = context.getValue(Query.ZONE_ID);
+ if (zone == null || (regionOnly && zone instanceof ZoneOffset)) {
+ return false;
}
+ buf.append(zone.getId());
return true;
}
@@ -2619,10 +2666,7 @@ private static SubstringTree prepareParser(Set<String> availableIDs) {
//-----------------------------------------------------------------------
@Override
public String toString() {
- if (textStyle == null) {
- return "ZoneId()";
- }
- return "ZoneText(" + textStyle + ")";
+ return (regionOnly ? "ZoneRegionId()" : "ZoneId()");
}
}
View
9 src/main/java/javax/time/format/DateTimeFormatters.java
@@ -601,6 +601,7 @@ public static DateTimeFormatter isoOffsetDateTime() {
* The format consists of:
* <p><ul>
* <li>The {@link #isoOffsetDateTime()}
+ * <li>If the zone ID is not available or is a {@code ZoneOffset} then the format is complete.
* <li>An open square bracket '['.
* <li>The {@link ZoneId#getId() zone ID}. This is not part of the ISO-8601 standard.
* <li>A close square bracket ']'.
@@ -617,9 +618,9 @@ public static DateTimeFormatter isoZonedDateTime() {
static {
ISO_ZONED_DATE_TIME = new DateTimeFormatterBuilder()
.append(ISO_OFFSET_DATE_TIME)
- .optionalStart() // TODO: remove
+ .optionalStart()
.appendLiteral('[')
- .appendZoneId()
+ .appendZoneRegionId()
.appendLiteral(']')
.toFormatter();
}
@@ -639,7 +640,7 @@ public static DateTimeFormatter isoZonedDateTime() {
* <li>If the offset is not available to print/parse then the format is complete.
* <li>The {@link ZoneOffset#getId() offset ID}. If the offset has seconds then
* they will be handled even though this is not part of the ISO-8601 standard.
- * <li>If the zone is not available to print/parse then the format is complete.
+ * <li>If the zone ID is not available or is a {@code ZoneOffset} then the format is complete.
* <li>An open square bracket '['.
* <li>The {@link ZoneId#getId() zone ID}. This is not part of the ISO-8601 standard.
* <li>A close square bracket ']'.
@@ -662,7 +663,7 @@ public static DateTimeFormatter isoDateTime() {
.appendOffsetId()
.optionalStart()
.appendLiteral('[')
- .appendZoneId()
+ .appendZoneRegionId()
.appendLiteral(']')
.toFormatter();
}
View
52 src/tck/java/javax/time/format/TCKDateTimeFormatters.java
@@ -682,21 +682,25 @@ public void test_parse_isoOffsetDateTime(
{2008, 6, 30, 11, 5, 30, 500000000, null, null, null, DateTimeException.class},
{2008, 6, 30, 11, 5, 30, 1, null, null, null, DateTimeException.class},
- {2008, 6, 30, 11, 5, null, null, "+01:00", null, null, DateTimeException.class},
- {2008, 6, 30, 11, 5, 30, null, "+01:00", null, null, DateTimeException.class},
- {2008, 6, 30, 11, 5, 30, 500000000, "+01:00", null, null, DateTimeException.class},
- {2008, 6, 30, 11, 5, 30, 1, "+01:00", null, null, DateTimeException.class},
+ // allow OffsetDateTime (no harm comes of this AFAICT)
+ {2008, 6, 30, 11, 5, null, null, "+01:00", null, "2008-06-30T11:05+01:00", null},
+ {2008, 6, 30, 11, 5, 30, null, "+01:00", null, "2008-06-30T11:05:30+01:00", null},
+ {2008, 6, 30, 11, 5, 30, 500000000, "+01:00", null, "2008-06-30T11:05:30.5+01:00", null},
+ {2008, 6, 30, 11, 5, 30, 1, "+01:00", null, "2008-06-30T11:05:30.000000001+01:00", null},
+ // ZonedDateTime with ZoneId of ZoneOffset
{2008, 6, 30, 11, 5, null, null, "+01:00", "+01:00", "2008-06-30T11:05+01:00", null},
{2008, 6, 30, 11, 5, 30, null, "+01:00", "+01:00", "2008-06-30T11:05:30+01:00", null},
{2008, 6, 30, 11, 5, 30, 500000000, "+01:00", "+01:00", "2008-06-30T11:05:30.5+01:00", null},
{2008, 6, 30, 11, 5, 30, 1, "+01:00", "+01:00", "2008-06-30T11:05:30.000000001+01:00", null},
+ // ZonedDateTime with ZoneId of ZoneRegion
{2008, 6, 30, 11, 5, null, null, "+01:00", "Europe/Paris", "2008-06-30T11:05+01:00[Europe/Paris]", null},
{2008, 6, 30, 11, 5, 30, null, "+01:00", "Europe/Paris", "2008-06-30T11:05:30+01:00[Europe/Paris]", null},
{2008, 6, 30, 11, 5, 30, 500000000, "+01:00", "Europe/Paris", "2008-06-30T11:05:30.5+01:00[Europe/Paris]", null},
{2008, 6, 30, 11, 5, 30, 1, "+01:00", "Europe/Paris", "2008-06-30T11:05:30.000000001+01:00[Europe/Paris]", null},
+ // offset required
{2008, 6, 30, 11, 5, null, null, null, "Europe/Paris", null, DateTimeException.class},
{2008, 6, 30, 11, 5, 30, null, null, "Europe/Paris", null, DateTimeException.class},
{2008, 6, 30, 11, 5, 30, 500000000, null, "Europe/Paris", null, DateTimeException.class},
@@ -731,7 +735,11 @@ public void test_parse_isoZonedDateTime(
String input, Class<?> invalid) {
if (input != null) {
DateTimeBuilder expected = createDateTime(year, month, day, hour, min, sec, nano);
- buildCalendrical(expected, offsetId, zoneId);
+ if (offsetId.equals(zoneId)) {
+ buildCalendrical(expected, offsetId, null);
+ } else {
+ buildCalendrical(expected, offsetId, zoneId);
+ }
assertParseMatch(DateTimeFormatters.isoZonedDateTime().parseToBuilder(input, new ParsePosition(0)), expected);
}
}
@@ -742,23 +750,23 @@ public void test_parse_isoZonedDateTime(
@DataProvider(name="sample_isoDateTime")
Object[][] provider_sample_isoDateTime() {
return new Object[][]{
-// {2008, null, null, null, null, null, null, null, null, null, DateTimeException.class},
-// {null, 6, null, null, null, null, null, null, null, null, DateTimeException.class},
-// {null, null, 30, null, null, null, null, null, null, null, DateTimeException.class},
-// {null, null, null, 11, null, null, null, null, null, null, DateTimeException.class},
-// {null, null, null, null, 5, null, null, null, null, null, DateTimeException.class},
-// {null, null, null, null, null, null, null, "+01:00", null, null, DateTimeException.class},
-// {null, null, null, null, null, null, null, null, "Europe/Paris", null, DateTimeException.class},
-// {2008, 6, 30, 11, null, null, null, null, null, null, DateTimeException.class},
-// {2008, 6, 30, null, 5, null, null, null, null, null, DateTimeException.class},
-// {2008, 6, null, 11, 5, null, null, null, null, null, DateTimeException.class},
-// {2008, null, 30, 11, 5, null, null, null, null, null, DateTimeException.class},
-// {null, 6, 30, 11, 5, null, null, null, null, null, DateTimeException.class},
-//
-// {2008, 6, 30, 11, 5, null, null, null, null, "2008-06-30T11:05", null},
-// {2008, 6, 30, 11, 5, 30, null, null, null, "2008-06-30T11:05:30", null},
-// {2008, 6, 30, 11, 5, 30, 500000000, null, null, "2008-06-30T11:05:30.5", null},
-// {2008, 6, 30, 11, 5, 30, 1, null, null, "2008-06-30T11:05:30.000000001", null},
+ {2008, null, null, null, null, null, null, null, null, null, DateTimeException.class},
+ {null, 6, null, null, null, null, null, null, null, null, DateTimeException.class},
+ {null, null, 30, null, null, null, null, null, null, null, DateTimeException.class},
+ {null, null, null, 11, null, null, null, null, null, null, DateTimeException.class},
+ {null, null, null, null, 5, null, null, null, null, null, DateTimeException.class},
+ {null, null, null, null, null, null, null, "+01:00", null, null, DateTimeException.class},
+ {null, null, null, null, null, null, null, null, "Europe/Paris", null, DateTimeException.class},
+ {2008, 6, 30, 11, null, null, null, null, null, null, DateTimeException.class},
+ {2008, 6, 30, null, 5, null, null, null, null, null, DateTimeException.class},
+ {2008, 6, null, 11, 5, null, null, null, null, null, DateTimeException.class},
+ {2008, null, 30, 11, 5, null, null, null, null, null, DateTimeException.class},
+ {null, 6, 30, 11, 5, null, null, null, null, null, DateTimeException.class},
+
+ {2008, 6, 30, 11, 5, null, null, null, null, "2008-06-30T11:05", null},
+ {2008, 6, 30, 11, 5, 30, null, null, null, "2008-06-30T11:05:30", null},
+ {2008, 6, 30, 11, 5, 30, 500000000, null, null, "2008-06-30T11:05:30.5", null},
+ {2008, 6, 30, 11, 5, 30, 1, null, null, "2008-06-30T11:05:30.000000001", null},
{2008, 6, 30, 11, 5, null, null, "+01:00", null, "2008-06-30T11:05+01:00", null},
{2008, 6, 30, 11, 5, 30, null, "+01:00", null, "2008-06-30T11:05:30+01:00", null},
View
267 src/test/java/javax/time/format/TestZoneIdParser.java
@@ -31,19 +31,6 @@
*/
package javax.time.format;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import javax.time.ZoneId;
-import javax.time.ZoneOffset;
-import javax.time.format.DateTimeFormatterBuilder.ZoneIdPrinterParser;
-import javax.time.zone.ZoneRulesProvider;
-
-import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
@@ -52,132 +39,132 @@
@Test(groups={"implementation"})
public class TestZoneIdParser extends AbstractTestPrinterParser {
- private static final String AMERICA_DENVER = "America/Denver";
- private static final ZoneId TIME_ZONE_DENVER = ZoneId.of(AMERICA_DENVER);
-
- //-----------------------------------------------------------------------
- @DataProvider(name="error")
- Object[][] data_error() {
- return new Object[][] {
- {new ZoneIdPrinterParser(null), "hello", -1, IndexOutOfBoundsException.class},
- {new ZoneIdPrinterParser(null), "hello", 6, IndexOutOfBoundsException.class},
- };
- }
-
- @Test(dataProvider="error")
- public void test_parse_error(ZoneIdPrinterParser pp, String text, int pos, Class<?> expected) {
- try {
- pp.parse(parseContext, text, pos);
- } catch (RuntimeException ex) {
- assertTrue(expected.isInstance(ex));
- assertEquals(parseContext.getParsed().size(), 0);
- }
- }
-
- //-----------------------------------------------------------------------
- public void test_parse_exactMatch_Denver() throws Exception {
- ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
- int result = pp.parse(parseContext, AMERICA_DENVER, 0);
- assertEquals(result, AMERICA_DENVER.length());
- assertParsed(TIME_ZONE_DENVER);
- }
-
- public void test_parse_startStringMatch_Denver() throws Exception {
- ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
- int result = pp.parse(parseContext, AMERICA_DENVER + "OTHER", 0);
- assertEquals(result, AMERICA_DENVER.length());
- assertParsed(TIME_ZONE_DENVER);
- }
-
- public void test_parse_midStringMatch_Denver() throws Exception {
- ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
- int result = pp.parse(parseContext, "OTHER" + AMERICA_DENVER + "OTHER", 5);
- assertEquals(result, 5 + AMERICA_DENVER.length());
- assertParsed(TIME_ZONE_DENVER);
- }
-
- public void test_parse_endStringMatch_Denver() throws Exception {
- ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
- int result = pp.parse(parseContext, "OTHER" + AMERICA_DENVER, 5);
- assertEquals(result, 5+ AMERICA_DENVER.length());
- assertParsed(TIME_ZONE_DENVER);
- }
-
- public void test_parse_partialMatch() throws Exception {
- ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
- int result = pp.parse(parseContext, "OTHERAmerica/Bogusville", 5);
- assertEquals(result, -6);
- assertParsed(null);
- }
-
- //-----------------------------------------------------------------------
- @DataProvider(name="zones")
- Object[][] populateTestData() {
- List<String> ids = new ArrayList<>();
- Set<String> groupIds = ZoneRulesProvider.getAvailableGroupIds();
- for (String groupId : groupIds) {
- ids.addAll(ZoneRulesProvider.getProvider(groupId).getAvailableRegionIds());
- }
- Object[][] rtnval = new Object[ids.size()][];
- int i = 0;
- for (String id : ids) {
- rtnval[i++] = new Object[] { id, ZoneId.of(id) };
- }
- return rtnval;
- }
-
- @Test(dataProvider="zones")
- public void test_parse_exactMatch(String parse, ZoneId expected) throws Exception {
- ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
- int result = pp.parse(parseContext, parse, 0);
- assertEquals(result, parse.length());
- assertParsed(expected);
- }
-
- //-----------------------------------------------------------------------
- public void test_parse_endStringMatch_utc() throws Exception {
- ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
- int result = pp.parse(parseContext, "OTHERZ", 5);
- assertEquals(result, 6);
- assertParsed(ZoneOffset.UTC);
- }
-
- public void test_parse_endStringMatch_utc_plus1() throws Exception {
- ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
- int result = pp.parse(parseContext, "OTHER+01:00", 5);
- assertEquals(result, 11);
- assertParsed(ZoneId.of("UTC+01:00"));
- }
-
- //-----------------------------------------------------------------------
- public void test_parse_midStringMatch_utc() throws Exception {
- ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
- int result = pp.parse(parseContext, "OTHERZOTHER", 5);
- assertEquals(result, 6);
- assertParsed(ZoneOffset.UTC);
- }
-
- public void test_parse_midStringMatch_utc_plus1() throws Exception {
- ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
- int result = pp.parse(parseContext, "OTHER+01:00OTHER", 5);
- assertEquals(result, 11);
- assertParsed(ZoneId.of("UTC+01:00"));
- }
-
- //-----------------------------------------------------------------------
- public void test_toString_id() {
- ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
- assertEquals(pp.toString(), "ZoneId()");
- }
-
- public void test_toString_text() {
- ZoneIdPrinterParser pp = new ZoneIdPrinterParser(TextStyle.FULL);
- assertEquals(pp.toString(), "ZoneText(FULL)");
- }
-
- private void assertParsed(ZoneId expectedZone) {
- assertEquals(parseContext.getParsed().size(), expectedZone == null ? 0 : 1);
- assertEquals(parseContext.getParsed(ZoneId.class), expectedZone);
- }
+// private static final String AMERICA_DENVER = "America/Denver";
+// private static final ZoneId TIME_ZONE_DENVER = ZoneId.of(AMERICA_DENVER);
+//
+// //-----------------------------------------------------------------------
+// @DataProvider(name="error")
+// Object[][] data_error() {
+// return new Object[][] {
+// {new ZoneIdPrinterParser(null), "hello", -1, IndexOutOfBoundsException.class},
+// {new ZoneIdPrinterParser(null), "hello", 6, IndexOutOfBoundsException.class},
+// };
+// }
+//
+// @Test(dataProvider="error")
+// public void test_parse_error(ZoneIdPrinterParser pp, String text, int pos, Class<?> expected) {
+// try {
+// pp.parse(parseContext, text, pos);
+// } catch (RuntimeException ex) {
+// assertTrue(expected.isInstance(ex));
+// assertEquals(parseContext.getParsed().size(), 0);
+// }
+// }
+//
+// //-----------------------------------------------------------------------
+// public void test_parse_exactMatch_Denver() throws Exception {
+// ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
+// int result = pp.parse(parseContext, AMERICA_DENVER, 0);
+// assertEquals(result, AMERICA_DENVER.length());
+// assertParsed(TIME_ZONE_DENVER);
+// }
+//
+// public void test_parse_startStringMatch_Denver() throws Exception {
+// ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
+// int result = pp.parse(parseContext, AMERICA_DENVER + "OTHER", 0);
+// assertEquals(result, AMERICA_DENVER.length());
+// assertParsed(TIME_ZONE_DENVER);
+// }
+//
+// public void test_parse_midStringMatch_Denver() throws Exception {
+// ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
+// int result = pp.parse(parseContext, "OTHER" + AMERICA_DENVER + "OTHER", 5);
+// assertEquals(result, 5 + AMERICA_DENVER.length());
+// assertParsed(TIME_ZONE_DENVER);
+// }
+//
+// public void test_parse_endStringMatch_Denver() throws Exception {
+// ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
+// int result = pp.parse(parseContext, "OTHER" + AMERICA_DENVER, 5);
+// assertEquals(result, 5+ AMERICA_DENVER.length());
+// assertParsed(TIME_ZONE_DENVER);
+// }
+//
+// public void test_parse_partialMatch() throws Exception {
+// ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
+// int result = pp.parse(parseContext, "OTHERAmerica/Bogusville", 5);
+// assertEquals(result, -6);
+// assertParsed(null);
+// }
+//
+// //-----------------------------------------------------------------------
+// @DataProvider(name="zones")
+// Object[][] populateTestData() {
+// List<String> ids = new ArrayList<>();
+// Set<String> groupIds = ZoneRulesProvider.getAvailableGroupIds();
+// for (String groupId : groupIds) {
+// ids.addAll(ZoneRulesProvider.getProvider(groupId).getAvailableRegionIds());
+// }
+// Object[][] rtnval = new Object[ids.size()][];
+// int i = 0;
+// for (String id : ids) {
+// rtnval[i++] = new Object[] { id, ZoneId.of(id) };
+// }
+// return rtnval;
+// }
+//
+// @Test(dataProvider="zones")
+// public void test_parse_exactMatch(String parse, ZoneId expected) throws Exception {
+// ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
+// int result = pp.parse(parseContext, parse, 0);
+// assertEquals(result, parse.length());
+// assertParsed(expected);
+// }
+//
+// //-----------------------------------------------------------------------
+// public void test_parse_endStringMatch_utc() throws Exception {
+// ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
+// int result = pp.parse(parseContext, "OTHERZ", 5);
+// assertEquals(result, 6);
+// assertParsed(ZoneOffset.UTC);
+// }
+//
+// public void test_parse_endStringMatch_utc_plus1() throws Exception {
+// ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
+// int result = pp.parse(parseContext, "OTHER+01:00", 5);
+// assertEquals(result, 11);
+// assertParsed(ZoneId.of("UTC+01:00"));
+// }
+//
+// //-----------------------------------------------------------------------
+// public void test_parse_midStringMatch_utc() throws Exception {
+// ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
+// int result = pp.parse(parseContext, "OTHERZOTHER", 5);
+// assertEquals(result, 6);
+// assertParsed(ZoneOffset.UTC);
+// }
+//
+// public void test_parse_midStringMatch_utc_plus1() throws Exception {
+// ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
+// int result = pp.parse(parseContext, "OTHER+01:00OTHER", 5);
+// assertEquals(result, 11);
+// assertParsed(ZoneId.of("UTC+01:00"));
+// }
+//
+// //-----------------------------------------------------------------------
+// public void test_toString_id() {
+// ZoneIdPrinterParser pp = new ZoneIdPrinterParser(null);
+// assertEquals(pp.toString(), "ZoneId()");
+// }
+//
+// public void test_toString_text() {
+// ZoneIdPrinterParser pp = new ZoneIdPrinterParser(TextStyle.FULL);
+// assertEquals(pp.toString(), "ZoneText(FULL)");
+// }
+//
+// private void assertParsed(ZoneId expectedZone) {
+// assertEquals(parseContext.getParsed().size(), expectedZone == null ? 0 : 1);
+// assertEquals(parseContext.getParsed(ZoneId.class), expectedZone);
+// }
}
Please sign in to comment.
Something went wrong with that request. Please try again.