public void test_print_append() throws Exception {
   printContext.setCalendrical(LocalDate.of(2012, 1, 3));
   NumberPrinterParser pp = new NumberPrinterParser(DAY_OF_MONTH, 1, 2, SignStyle.NEVER);
   buf.append("EXISTING");
   pp.print(printContext, buf);
   assertEquals(buf.toString(), "EXISTING3");
 }
 @Test(dataProvider = "Pad")
 public void test_pad_NEVER(int minPad, int maxPad, long value, String result) throws Exception {
   printContext.setCalendrical(new MockFieldValue(DAY_OF_MONTH, value));
   NumberPrinterParser pp = new NumberPrinterParser(DAY_OF_MONTH, minPad, maxPad, SignStyle.NEVER);
   try {
     pp.print(printContext, buf);
     if (result == null) {
       fail("Expected exception");
     }
     assertEquals(buf.toString(), result);
   } catch (DateTimePrintException ex) {
     if (result != null) {
       throw ex;
     }
     assertEquals(ex.getMessage().contains(DAY_OF_MONTH.getName()), true);
   }
 }
 @Test(dataProvider = "Pad")
 public void test_pad_EXCEEDS_PAD(int minPad, int maxPad, long value, String result)
     throws Exception {
   printContext.setCalendrical(new MockFieldValue(DAY_OF_MONTH, value));
   NumberPrinterParser pp =
       new NumberPrinterParser(DAY_OF_MONTH, minPad, maxPad, SignStyle.EXCEEDS_PAD);
   try {
     pp.print(printContext, buf);
     if (result == null) {
       fail("Expected exception");
       return; // unreachable
     }
     if (result.length() > minPad || value < 0) {
       result = (value < 0 ? "-" + result : "+" + result);
     }
     assertEquals(buf.toString(), result);
   } catch (DateTimePrintException ex) {
     if (result != null) {
       throw ex;
     }
     assertEquals(ex.getMessage().contains(DAY_OF_MONTH.getName()), true);
   }
 }
 // -----------------------------------------------------------------------
 @Test(expectedExceptions = DateTimeException.class)
 public void test_print_emptyCalendrical() throws Exception {
   NumberPrinterParser pp = new NumberPrinterParser(DAY_OF_MONTH, 1, 2, SignStyle.NEVER);
   pp.print(printEmptyContext, buf);
 }
 public void test_toString3() throws Exception {
   NumberPrinterParser pp = new NumberPrinterParser(HOUR_OF_DAY, 1, 2, SignStyle.NOT_NEGATIVE);
   assertEquals(pp.toString(), "Value(HourOfDay,1,2,NOT_NEGATIVE)");
 }
 // -----------------------------------------------------------------------
 public void test_toString1() throws Exception {
   NumberPrinterParser pp = new NumberPrinterParser(HOUR_OF_DAY, 1, 19, SignStyle.NORMAL);
   assertEquals(pp.toString(), "Value(HourOfDay)");
 }