AsyncRetrieveMessageFormat implements FormatTS { @Override public String formatObject(Object item) { if (item!=null) { AsyncRetrieveMessage msg = (AsyncRetrieveMessage)item; StringBuffer buffer = new StringBuffer(); buffer.append(getStringOrBlank(dateFormat.formatObject(msg.getDate()))); buffer.append(getSeparator()); buffer.append(getStringOrBlank(msg.getPatientId())); buffer.append(getSeparator()); buffer.append(getStringOrBlank(msg.getPatientName())); return buffer.toString(); } return null; }  String getSeparator(); void setSeparator(String separator); FormatTS getDateFormat(); void setDateFormat(FormatTS dateFormat); @Override String formatObject(Object item); @Override Object parse(String data);  }
@Test public void formatText() { String text = msgFormat.formatObject(new AsyncRetrieveMessage(getDate(2012, 10, 10, 16, 15, 14), "223344", "jill")); Assert.assertEquals("20121110161514:223344:jill", text); }