public void testCanUsePersistenceCollectionAsConverter() throws IOException {
xstream.alias("lists", SampleLists.class);
xstream.alias("software", Software.class);
xstream.registerLocalConverter(SampleLists.class, "good", new PersistenceArrayListConverter());
SampleLists lists = new SampleLists();
lists.good.add("Guilherme");
lists.good.add(new Integer(1970));
lists.good.add(new Software("Codehaus", "XStream"));
String expected = "" +
"<lists>\n" +
" <good>" + dir.getPath() + "</good>\n" +
" <bad class=\"list\"/>\n" +
"</lists>";
// assumes 'lists' is serialized first
SampleLists serialized = (SampleLists)assertBothWays(lists, expected);
// compare original list and list written in separate XML file
assertEquals(lists.good, serialized.good);
// retrieve value from external file