DummyWme extends AbstractAdaptable implements Wme { @Override public void formatTo(Formatter fmt, int f, int width, int precision) { if((f & FormattableFlags.ALTERNATE) == 0) { fmt.format("(%d: %s ^%s %s%s)\n", getTimetag(), id, attr, value, isAcceptable() ? " +" : ""); } else { fmt.format("(%s ^%s %s%s)\n", id, attr, value, isAcceptable() ? " +" : ""); } } DummyWme(Identifier id, Symbol attr, Symbol value); static DummyWme create(SymbolFactory syms, Object id, Object attr, Object value); static Set<Wme> create(SymbolFactory syms, Object... wmes); @Override Symbol getAttribute(); @Override Iterator<Wme> getChildren(); @Override Identifier getIdentifier(); @Override Iterator<Preference> getPreferences(); @Override int getTimetag(); @Override Symbol getValue(); @Override boolean isAcceptable(); @Override void formatTo(Formatter fmt, int f, int width, int precision);  }
@Test public void testFormatTo() { final Identifier id = syms.createIdentifier('T'); final Symbol attr = syms.createString("attr"); final Symbol value = syms.createInteger(3); final DummyWme wme = new DummyWme(id, attr, value); assertEquals("(-1: T1 ^attr 3)\n", String.format("%s", wme)); }