@Test
public void testRoundTrip() throws Exception {
XmlSchema schema = null;
DetailedDiff detaileddiffs = null;
try {
schema = loadSchema(currentTest.getTestCase(), currentTest.getBaseFilePathname());
// TODO: if we get here and the input was meant to be invalid perhaps
// should fail. Depends on whether XmlSchema is doing validation. For
// now we're ignoring invalid tests.
ByteArrayOutputStream baos = new ByteArrayOutputStream();
schema.write(baos);
InputStreamReader inputStreamReader = new InputStreamReader(currentTest.getTestCase(),
UTF8);
Diff diff = new Diff(inputStreamReader,
new InputStreamReader(new ByteArrayInputStream(baos.toByteArray()), UTF8));
detaileddiffs = new DetailedDiff(diff);
detaileddiffs.overrideDifferenceListener(new SchemaAttrDiff());
boolean result = detaileddiffs.similar();
if (!result) {
printFailureDetail(schema, detaileddiffs);
}
assertTrue("Serialized out schema not similar to original", result);
} catch (Exception e) {