DSObject implements IObject { @Override public <T> T serialize() throws SerializeException { try { return (T) OBJECT_MAPPER.writer().writeValueAsString(body); } catch (Throwable e) { throw new SerializeException(); } } DSObject(final Map<IFieldName, Object> objectEntries);  DSObject(final String body);  DSObject(); @Override Object getValue(final IFieldName name); @Override void setValue(final IFieldName name, final Object value); @Override void deleteField(final IFieldName name); @Override T serialize(); @Override Iterator<Map.Entry<IFieldName, Object>> iterator();  }
@Test public void checkSerialization() throws Exception { String json = "{\"value\":1,\"string\":\"foo\"}"; IObject obj = new DSObject(json); assertEquals(json, obj.serialize()); }