|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
59 | 59 | */
|
60 | 60 | package test.java.time.format;
|
61 | 61 |
|
| 62 | +import static java.time.temporal.ChronoField.MILLI_OF_SECOND; |
62 | 63 | import static java.time.temporal.ChronoField.NANO_OF_SECOND;
|
63 | 64 | import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
|
64 | 65 | import static org.testng.Assert.assertEquals;
|
|
77 | 78 |
|
78 | 79 | /**
|
79 | 80 | * Test FractionPrinterParser.
|
| 81 | + * |
| 82 | + * @bug 8230136 |
80 | 83 | */
|
81 | 84 | @Test
|
82 | 85 | public class TestFractionPrinterParser extends AbstractTestPrinterParser {
|
@@ -331,6 +334,24 @@ public void test_parse_nothing(TemporalField field, int min, int max, boolean de
|
331 | 334 | assertEquals(parsed, null);
|
332 | 335 | }
|
333 | 336 |
|
| 337 | + @DataProvider(name="ParseMinWidth") |
| 338 | + Object[][] provider_parseMinWidth() { |
| 339 | + return new Object[][] { |
| 340 | + {MILLI_OF_SECOND, 3, 3, true, ".1x"}, |
| 341 | + {MILLI_OF_SECOND, 3, 3, true, ".12x"}, |
| 342 | + {MILLI_OF_SECOND, 3, 3, true, ".1234x"}, |
| 343 | + }; |
| 344 | + } |
| 345 | + |
| 346 | + @Test(dataProvider="ParseMinWidth", expectedExceptions=DateTimeException.class) |
| 347 | + public void test_parse_minWidth(TemporalField field, int min, int max, boolean decimalPoint, String text) throws Exception { |
| 348 | + builder |
| 349 | + .appendFraction(field, min, max, decimalPoint) |
| 350 | + .appendLiteral("x") |
| 351 | + .toFormatter(locale) |
| 352 | + .parse(text); |
| 353 | + } |
| 354 | + |
334 | 355 | //-----------------------------------------------------------------------
|
335 | 356 | public void test_toString() throws Exception {
|
336 | 357 | assertEquals(getFormatter(NANO_OF_SECOND, 3, 6, true).toString(), "Fraction(NanoOfSecond,3,6,DecimalPoint)");
|
|
0 commit comments