Search in sources :

Example 1 with SMEvent

use of org.codehaus.staxmate.in.SMEvent in project sonar-java by SonarSource.

the class SurefireStaxHandler method stream.

public void stream(SMHierarchicCursor rootCursor) throws XMLStreamException {
    SMInputCursor testSuite = rootCursor.constructDescendantCursor(new ElementFilter("testsuite"));
    SMEvent testSuiteEvent;
    for (testSuiteEvent = testSuite.getNext(); testSuiteEvent != null; testSuiteEvent = testSuite.getNext()) {
        if (testSuiteEvent.compareTo(SMEvent.START_ELEMENT) == 0) {
            String testSuiteClassName = testSuite.getAttrValue("name");
            if (StringUtils.contains(testSuiteClassName, "$")) {
                // test suites for inner classes are ignored
                return;
            }
            parseTestCase(testSuiteClassName, testSuite.childCursor(new ElementFilter("testcase")));
        }
    }
}
Also used : SMInputCursor(org.codehaus.staxmate.in.SMInputCursor) ElementFilter(org.codehaus.staxmate.in.ElementFilter) SMEvent(org.codehaus.staxmate.in.SMEvent)

Example 2 with SMEvent

use of org.codehaus.staxmate.in.SMEvent in project sonar-java by SonarSource.

the class SurefireStaxHandler method parseTestCase.

private void parseTestCase(String testSuiteClassName, SMInputCursor testCase) throws XMLStreamException {
    for (SMEvent event = testCase.getNext(); event != null; event = testCase.getNext()) {
        if (event.compareTo(SMEvent.START_ELEMENT) == 0) {
            String testClassName = getClassname(testCase, testSuiteClassName);
            UnitTestClassReport classReport = index.index(testClassName);
            parseTestCase(testCase, testSuiteClassName, classReport);
        }
    }
}
Also used : SMEvent(org.codehaus.staxmate.in.SMEvent)

Aggregations

SMEvent (org.codehaus.staxmate.in.SMEvent)2 ElementFilter (org.codehaus.staxmate.in.ElementFilter)1 SMInputCursor (org.codehaus.staxmate.in.SMInputCursor)1