}
public void testValidateDocument(String fileName, String mimeType,
List<MessageId> errors, List<MessageId> warnings, List<MessageId> fatalErrors, EPUBVersion version, boolean verbose, ExtraReportTest extraTest)
{
ValidationReport testReport = new ValidationReport(fileName, String.format(Messages.get("single_file"), mimeType, version));
String basepath = null;
if (version == EPUBVersion.VERSION_2)
{
basepath = "/20/single/";
}
else if (version == EPUBVersion.VERSION_3)
{
basepath = "/30/single/";
}
GenericResourceProvider resourceProvider = null;
if (fileName.startsWith("http://") || fileName.startsWith("https://"))
{
resourceProvider = new URLResourceProvider(fileName);
}
else
{
URL fileURL = this.getClass().getResource(basepath + fileName);
String filePath = fileURL != null ? fileURL.getPath() : basepath + fileName;
resourceProvider = new FileResourceProvider(filePath);
}
OPSChecker opsChecker = new OPSChecker(basepath + fileName, mimeType,
resourceProvider, testReport, version);
opsChecker.validate();
if (verbose)
{
outWriter.println(testReport);
}
assertEquals("The error results do not match", errors, testReport.getErrorIds());
assertEquals("The warning results do not match", warnings, testReport.getWarningIds());
assertEquals("The fatal error results do not match", fatalErrors, testReport.getFatalErrorIds());
if (extraTest != null)
{
extraTest.test(testReport);
}
}