### Question:
FormatterDecorator extends
    EventSinkDecorator<S> { public void append(Event e) throws IOException { Preconditions.checkNotNull(e); String body = e.escapeString(formatString); Event e2 = new EventImpl(body.getBytes(), e.getTimestamp(), e.getPriority(), e.getNanos(), e.getHost()); for (Entry<String, byte[]> entry : e.getAttrs().entrySet()) { e2.set(entry.getKey(), entry.getValue()); } super.append(e2); } FormatterDecorator(S s, String formatString); void append(Event e); static SinkDecoBuilder builder();  }### Answer:
@Test public void testFormat() throws IOException{ MemorySinkSource mem = new MemorySinkSource(); EventSink format = new FormatterDecorator<EventSink>(mem, "test %{body}"); Event e = new EventImpl("content".getBytes()); e.set("attr1", "value".getBytes()); format.open(); format.append(e); format.close(); mem.open(); Event e2 = mem.next(); assertEquals("test content", new String(e2.getBody())); assertEquals("value", Attributes.readString(e2, "attr1")); }