Posted By:
Anonymous
Posted On:
Monday, March 25, 2002 06:36 AM
I wanted to write a Junit test which tests a class which parses xml files. From within my application the class works fine and does not throw exception. When I try to run a JUnit test I get the exception java.lang.ClassCastException: org.apache.xerces.parsers.StandardParserConfiguration at org.apache.xerces.parsers.DOMParser. (DOMParser.java:109) at de.wfb.xml.XmlTournament.getDOM(XmlTournament.java:73) at de.wfb.xml.XmlTournament.getTournament(XmlTournament.java, Compiled Code) at de.wfb.tests.XMLTest.testGetTournament(XMLTest.java:55) the relevant lines in class to be tested: import org.apache.xerces.parsers.DOMParser; import org.apache.xerces.do
More>>
I wanted to write a Junit test which tests a class which parses xml files.
From within my application the class works fine and does not throw exception. When I try to run a JUnit test I get the exception
java.lang.ClassCastException: org.apache.xerces.parsers.StandardParserConfiguration
at org.apache.xerces.parsers.DOMParser.
(DOMParser.java:109)
at de.wfb.xml.XmlTournament.getDOM(XmlTournament.java:73)
at de.wfb.xml.XmlTournament.getTournament(XmlTournament.java, Compiled Code)
at de.wfb.tests.XMLTest.testGetTournament(XMLTest.java:55)
the relevant lines in class to be tested:
import org.apache.xerces.parsers.DOMParser;
import org.apache.xerces.dom.*;
....
private org.apache.xerces.parsers.DOMParser parser;
.....
parser = new org.apache.xerces.parsers.DOMParser();
The last line throws the exception
Any ideas?
Thanks,
Hans
<<Less