IntervalOfTimeFormatter { public void printTo(StringBuffer buffer, IntervalOfTime interval) { if (interval == null) return; if (intervalForm) { if (interval.isLowClosed()) { buffer.append('['); } else { buffer.append(']'); } buffer.append(interval.getLow().toString()); buffer.append(INTERVAL_FORM_SEPARATOR); buffer.append(interval.getHigh().toString()); if (interval.isHighClosed()) { buffer.append(']'); } else { buffer.append('['); } } else { interval = interval.toClosed(); buffer.append(interval.getLow().toString()); buffer.append(DEFAULT_SEPARATOR); buffer.append(interval.getHigh().toString()); } } IntervalOfTimeFormatter();  IntervalOfTimeFormatter(boolean intervalForm); IntervalOfTime parseInterval(String text); static IntervalOfTime create(String start, String stop, boolean lowClosed, boolean highClosed); String print(IntervalOfTime interval); void printTo(StringBuffer buffer, IntervalOfTime interval);  }
@Test public void testPrintToStringBuffer() { StringBuffer buf = new StringBuffer(); formatter.printTo(buf, INTERVAL); assertEquals("19750723000000.000..19750723235959.999", buf.toString()); }
@Test public void testPrintToStringBufferIntervalForm() { StringBuffer buf = new StringBuffer(); formatter = new IntervalOfTimeFormatter(true); formatter.printTo(buf, INTERVAL); assertEquals("[19750723000000.000;19750724000000.000[", buf.toString()); }