Skip to content
Snippets Groups Projects
Commit 8608fe03 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

this exception is not thrown in a constructor anymore

parent aebcbc01
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!386Resolve "Continous integration tests"
......@@ -419,56 +419,4 @@ public class XmlParserTest {
throw e;
}
}
@Test
public void testExceptionInConstructor() throws Exception {
DocumentBuilderFactory factory = null;
Field privateStringField = XmlParser.class.getDeclaredField("documentBuilderFactory");
try {
privateStringField.setAccessible(true);
factory = (DocumentBuilderFactory) privateStringField.get(parser);
privateStringField.set(parser, new DocumentBuilderFactory() {
@Override
public void setFeature(String name, boolean value) throws ParserConfigurationException {
// TODO Auto-generated method stub
}
@Override
public void setAttribute(String name, Object value) throws IllegalArgumentException {
// TODO Auto-generated method stub
}
@Override
public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
throw new ParserConfigurationException();
}
@Override
public boolean getFeature(String name) throws ParserConfigurationException {
// TODO Auto-generated method stub
return false;
}
@Override
public Object getAttribute(String name) throws IllegalArgumentException {
// TODO Auto-generated method stub
return null;
}
});
new XmlParser();
fail("Exception expected");
} catch (InvalidStateException e) {
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
privateStringField.set(parser, factory);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment