private int testSingleAnalyze(String xhtmlTag, String attrName, String attributeValue) { Document doc; HentryChildAnalyzer instance = new HentryChildAnalyzer(); try { doc = TestUtils.stringToDom(xhtmlTag); } catch (Exception ex) { fail("Unable to create DOM document :" + ex.getMessage()); ex.printStackTrace(); return -1; } instance.setXhtmlDoc(doc); instance.setNode(doc.getDocumentElement()); instance.setAttributeName(attrName); instance.setAttributeValue(attributeValue); instance.setDocumentName(DOC_NAME); try { instance.analyze(); List<Report> reps = ValidatorCache.getInstance().getEngine(DOC_NAME).getReports(); TestUtils.dumpReports(reps); int reportSize = reps.size(); ValidatorCache.getInstance().getEngine(DOC_NAME).getReports().clear(); return reportSize; } catch (IOException iOException) { fail("Analyze raised an exception :" + iOException.getMessage()); return -1; } }
@BeforeClass public static void setUpClass() throws Exception { // We create cache that will be used to store reports fot this test class ValidatorCache.getInstance().createEngine(DOC_NAME); }