PeriodFormatter f = builder.appendHours().appendSuffix(new String[] { "^1$", "^2$" }, new String[] { " hour", " hours" }).toFormatter();
assertEquals("5 hours", f.print(PERIOD));
assertEquals(7, f.getPrinter().calculatePrintedLength(PERIOD, null));
assertEquals(1, f.getPrinter().countFieldsToPrint(PERIOD, Integer.MAX_VALUE, null));
Period p2 = new Period(0, 0, 0, 0, 2, 0, 0, 0);
assertEquals("2 hours", f.print(p2));
assertEquals(7, f.getPrinter().calculatePrintedLength(p2, null));
assertEquals(1, f.getPrinter().countFieldsToPrint(p2, Integer.MAX_VALUE, null));
Period p0 = new Period(0, 0, 0, 0, 0, 0, 0, 0);
assertEquals("0 hours", f.print(p0));
assertEquals(7, f.getPrinter().calculatePrintedLength(p0, null));
assertEquals(1, f.getPrinter().countFieldsToPrint(p0, Integer.MAX_VALUE, null));
}