{
FSDirectory unserializedDir = null;
try
{
final File file = indexDir;
final Persister persister = new Persister();
final StringWriter writer = new StringWriter();
persister.write(SimpleXmlWrappers.wrap(directory), writer);
final SimpleXmlWrapperValue wrapper = persister.read(
SimpleXmlWrapperValue.class, new StringReader(writer.toString()));
assertThat(wrapper).describedAs("Wrapper for: " + writer.toString()).isNotNull();
unserializedDir = SimpleXmlWrappers.unwrap(wrapper);
assertThat(unserializedDir).isNotNull();