use of org.xml.sax.SAXParseException in project robovm by robovm.
the class XMLFilterImplTest method testError.
public void testError() {
SAXParseException exception = new SAXParseException("Oops!", null);
try {
parent.error(exception);
} catch (SAXException e) {
throw new RuntimeException("Unexpected exception", e);
}
assertEquals(logger.size(), 1);
assertEquals("error", logger.getMethod());
assertEquals(new Object[] { exception }, logger.getArgs());
}
use of org.xml.sax.SAXParseException in project robovm by robovm.
the class XMLFilterImplTest method testFatalError.
public void testFatalError() {
SAXParseException exception = new SAXParseException("Oops!", null);
try {
parent.fatalError(exception);
} catch (SAXException e) {
throw new RuntimeException("Unexpected exception", e);
}
assertEquals(logger.size(), 1);
assertEquals("fatalError", logger.getMethod());
assertEquals(new Object[] { exception }, logger.getArgs());
}
use of org.xml.sax.SAXParseException in project robovm by robovm.
the class DefaultHandlerTest method testFatalError.
public void testFatalError() {
// Ordinary case
try {
h.fatalError(new SAXParseException("Foo", new LocatorImpl()));
fail("SAXException expected");
} catch (SAXException e) {
// Expected
}
// No exception
try {
h.fatalError(null);
fail("NullPointerException expected");
} catch (SAXException e) {
fail("NullPointerException expected");
} catch (NullPointerException e) {
// Expected
}
}
use of org.xml.sax.SAXParseException in project robovm by robovm.
the class SAXExceptionTest method testSAXException_String_Exception.
public void testSAXException_String_Exception() {
Exception c = new Exception();
// Ordinary case
SAXException e = new SAXException(ERR, c);
assertEquals(ERR, e.getMessage());
assertEquals(c, e.getException());
// No message
e = new SAXException(null, c);
assertNull(e.getMessage());
assertEquals(c, e.getException());
// No cause
e = new SAXParseException(ERR, null);
assertEquals(ERR, e.getMessage());
assertNull(e.getException());
}
use of org.xml.sax.SAXParseException in project robovm by robovm.
the class SAXParseExceptionTest method testSAXParseException_String_Locator_Exception.
public void testSAXParseException_String_Locator_Exception() {
LocatorImpl l = new LocatorImpl();
l.setPublicId(PUB);
l.setSystemId(SYS);
l.setLineNumber(ROW);
l.setColumnNumber(COL);
Exception c = new Exception();
// Ordinary case
SAXParseException e = new SAXParseException(ERR, l, c);
assertEquals(ERR, e.getMessage());
assertEquals(c, e.getException());
assertEquals(PUB, e.getPublicId());
assertEquals(SYS, e.getSystemId());
assertEquals(ROW, e.getLineNumber());
assertEquals(COL, e.getColumnNumber());
// No message
e = new SAXParseException(null, l, c);
assertNull(e.getMessage());
assertEquals(c, e.getException());
assertEquals(PUB, e.getPublicId());
assertEquals(SYS, e.getSystemId());
assertEquals(ROW, e.getLineNumber());
assertEquals(COL, e.getColumnNumber());
// No locator
e = new SAXParseException(ERR, null, c);
assertEquals(ERR, e.getMessage());
assertEquals(c, e.getException());
assertNull(e.getPublicId());
assertNull(e.getSystemId());
assertEquals(-1, e.getLineNumber());
assertEquals(-1, e.getColumnNumber());
// No cause
e = new SAXParseException(ERR, l, null);
assertEquals(ERR, e.getMessage());
assertNull(e.getException());
assertEquals(PUB, e.getPublicId());
assertEquals(SYS, e.getSystemId());
assertEquals(ROW, e.getLineNumber());
assertEquals(COL, e.getColumnNumber());
}
Aggregations