}
private Testcase loadTestCase(Element element) {
if(!"testcase".equalsIgnoreCase(element.getNodeName()))
throw new IllegalArgumentException("Non 'testcase' element passed to #loadTestCase");
Testcase o = JunitresultFactory.eINSTANCE.createTestcase();
o.setClassname(element.getAttribute("classname"));
o.setName(element.getAttribute("name"));
o.setTime(getTime(element, "time"));
// Only one of these are allowed - error, failure, skipped
// let the last win
// Error element
NodeList errors = element.getElementsByTagName("error");
for(int i = 0; i < errors.getLength(); i++) {
Error error = JunitresultFactory.eINSTANCE.createError();
loadNegativeResult(error, errors);
o.getErrors().add(error);
}
// Failure element
NodeList failures = element.getElementsByTagName("failure");
for(int i = 0; i < failures.getLength(); i++) {
Failure failure = JunitresultFactory.eINSTANCE.createFailure();
loadNegativeResult(failure, failures);
o.getFailures().add(failure);
}
// Skipped element
NodeList skipps = element.getElementsByTagName("skipped");
if(skipps.getLength() > 0) {
Skipped skipped = JunitresultFactory.eINSTANCE.createSkipped();
loadNegativeResult(skipped, skipps);
o.setSkipped(skipped);
}
o.getSystem_err().addAll(getTagValues(element, "system-err"));
o.getSystem_out().addAll(getTagValues(element, "system-out"));
return o;
}