}
public void testWriteArrayWithSetter() throws Exception {
StringWriter out = new StringWriter();
out.write("<?xml version='1.0'?>");
BeanWriter writer = new BeanWriter(out);
writer.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
writer.getBindingConfiguration().setMapIDs(false);
LibraryBeanWithArraySetter libraryBean = new LibraryBeanWithArraySetter();
BookBean[] books = {
new BookBean("Martin Fowler", "Refactoring", "Addision Wesley"),
new BookBean("Ben Laurie", "Apache", "O'Reilly"),
new BookBean("Kent Beck", "Test Driven Development", "Addision Wesley")};
libraryBean.setBooks(books);
writer.write(libraryBean);
String xml = out.toString();
String expected = "<?xml version='1.0'?><LibraryBeanWithArraySetter>" +
"<books>" +
"<BookBean author='Martin Fowler' title='Refactoring' publisher='Addision Wesley'/>" +
"<BookBean author='Ben Laurie' title='Apache' publisher='O'Reilly'/>" +