URL expectedUrl = this.getClass().getResource(expected);
File expectedSchemaFile = new File(expectedUrl.toURI());
// 3. compare using org.castor.xmlctf.xmldiff.XMLDiff
XMLDiff diff = new XMLDiff(targetedOutput.getAbsolutePath(), expectedSchemaFile.getAbsolutePath());
int result = diff.compare();
TestResult testResult = result == 0 ? TestResult.IDENTICAL : TestResult.DIFFERENCE;
// 4. delete temporary file
targetedOutput.delete();