final String value = "text";
final DefaultConfiguration configuration = new DefaultConfiguration( name, "", "" );
final DefaultConfiguration child = new DefaultConfiguration( childName, "", "" );
configuration.addChild( child );
child.setValue( value );
final SAXConfigurationSerializer serializer = new MockSAXConfigurationSerializer();
final MockInvocationRecorder recorder = new MockInvocationRecorder();
recorder.addInvocation( SAXMethods.START_ELEMENT,
new Object[]{"", name, name,
MockSAXConfigurationSerializer.ATTRIBUTES},
null );
recorder.addInvocation( SAXMethods.START_ELEMENT,
new Object[]{"", childName, childName,
MockSAXConfigurationSerializer.ATTRIBUTES},
null );
recorder.addInvocation( SAXMethods.CHARACTERS,
new Object[]{value.toCharArray(), new Integer( 0 ), new Integer( 0 )},
null );
recorder.addInvocation( SAXMethods.END_ELEMENT,
new Object[]{"", childName, childName},
null );
recorder.addInvocation( SAXMethods.END_ELEMENT,
new Object[]{"", name, name},
null );
final ContentHandler handler = (ContentHandler)
Proxy.newProxyInstance( getClass().getClassLoader(),
new Class[]{ContentHandler.class},
recorder );
serializer.serializeElement( configuration, handler );
}