CycLFormat extends Format { @Override public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { final String command = buildFormatCommand(obj); try { toAppendTo.append(getCycAccess().converseString(command)); } catch (Exception ex) { throw new RuntimeException("Exception formatting " + obj, ex); } return toAppendTo; } protected  CycLFormat(CycAccess cyc); static CycLFormat getInstance(CycAccess cyc); void setWrapLines(boolean newlines); void setShowHashDollar(boolean showHashDollar); @Override StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos); @Override Object parseObject(String source, ParsePosition pos);  }
@Test public void testFormat() throws ParseException { System.out.println("format"); Object obj = instance.parseObject("(#$implies (#$isa ?X #$Cat) (#$likesAsFriend ?X #$CycAdministrator))", new ParsePosition(0)); StringBuffer toAppendTo = new StringBuffer(); FieldPosition pos = null; String expResult = "(#$implies (#$isa ?X #$Cat) (#$likesAsFriend ?X #$CycAdministrator))"; instance.setShowHashDollar(true); instance.setWrapLines(false); StringBuffer result = instance.format(obj, toAppendTo, pos); assertEquals(expResult, result.toString()); }