### Question:
CGLibProxyFormat extends CustomXMLFormat<Object> { private Object createProxy( final Class<?> targetClass, final Class<?>[] interfaces, final Callback[] callbacks ) { final Enhancer e = new Enhancer(); e.setInterfaces( interfaces ); e.setSuperclass( targetClass ); e.setCallbacks( callbacks ); return e.create(); }  @Override boolean canConvert( final Class<?> cls ); @Override Class<?> getTargetClass( final Class<?> cls ); @Override boolean isReferenceable(); @Override Object newInstance( final Class<Object> cls, final InputElement xml ); @Override void read( final InputElement arg0, final Object arg1 ); @Override void write( final Object obj, final OutputElement xml );  }### Answer:
@Test( enabled = true ) public void testCGLibProxy() throws XMLStreamException { final ClassToProxy proxy = createProxy( new ClassToProxy() ); proxy.setValue( "foo" ); final byte[] serialized = serialize( proxy, _binding ); System.out.println( new String( serialized ) ); final ClassToProxy deserialized = deserialize( serialized, _binding ); Assert.assertEquals( deserialized.getValue(), proxy.getValue() ); }
@Test( enabled = true ) public void testCGLibProxyForExistingFormat() throws XMLStreamException { final Map<String, String> proxy = createProxy( new HashMap<String, String>() ); proxy.put( "foo", "bar" ); Assert.assertEquals( proxy.get( "foo" ), "bar" ); final byte[] serialized = serialize( proxy, _binding ); System.out.println( new String( serialized ) ); final Map<String, String> deserialized = deserialize( serialized, _binding ); Assert.assertEquals( deserialized.get( "foo" ), proxy.get( "foo" ) ); }