use of org.xml.sax.ext.Attributes2Impl in project jPOS by jpos.
the class GenericValidatingPackagerTest method testGenericValidatorContentHandlerStartElement1.
@Test
public void testGenericValidatorContentHandlerStartElement1() throws Throwable {
GenericValidatingPackager.GenericValidatorContentHandler genericValidatorContentHandler = new GenericValidatingPackager().new GenericValidatorContentHandler();
Attributes atts = new Attributes2Impl();
genericValidatorContentHandler.startElement("testGenericValidatorContentHandlerNamespaceURI", "testGenericValidatorContentHandlerLocalName", "testGenericValidatorContentHandlerQName", atts);
}
use of org.xml.sax.ext.Attributes2Impl in project jPOS by jpos.
the class GenericValidatingPackagerTest method testGenericValidatorContentHandlerStartElementThrowsSAXException10.
@Test
public void testGenericValidatorContentHandlerStartElementThrowsSAXException10() throws Throwable {
GenericValidatingPackager.GenericValidatorContentHandler genericValidatorContentHandler = new GenericValidatingPackager().new GenericValidatorContentHandler();
Attributes atts = new Attributes2Impl();
try {
genericValidatorContentHandler.startElement("testGenericValidatorContentHandlerNamespaceURI", "isopackager", "testGenericValidatorContentHandlerQName", atts);
fail("Expected SAXException to be thrown");
} catch (SAXException ex) {
assertNull("ex.getMessage()", ex.getMessage());
assertNull("ex.getException().getMessage()", ex.getException().getMessage());
}
}
use of org.xml.sax.ext.Attributes2Impl in project robovm by robovm.
the class Attributes2ImplTest method testRemoveAttribute.
public void testRemoveAttribute() {
Attributes2Impl attrs = new Attributes2Impl(multi);
// Ordinary case
attrs.removeAttribute(1);
assertEquals(3, attrs.getLength());
assertEquals(multi.getURI(0), attrs.getURI(0));
assertEquals(multi.getLocalName(0), attrs.getLocalName(0));
assertEquals(multi.getQName(0), attrs.getQName(0));
assertEquals(multi.getType(0), attrs.getType(0));
assertEquals(multi.getValue(0), attrs.getValue(0));
assertEquals(multi.isDeclared(0), attrs.isDeclared(0));
assertEquals(multi.isSpecified(0), attrs.isSpecified(0));
assertEquals(multi.getURI(2), attrs.getURI(1));
assertEquals(multi.getLocalName(2), attrs.getLocalName(1));
assertEquals(multi.getQName(2), attrs.getQName(1));
assertEquals(multi.getType(2), attrs.getType(1));
assertEquals(multi.getValue(2), attrs.getValue(1));
assertEquals(multi.isDeclared(2), attrs.isDeclared(1));
assertEquals(multi.isSpecified(2), attrs.isSpecified(1));
// Out of range
try {
attrs.removeAttribute(-1);
fail("ArrayIndexOutOfBoundsException expected");
} catch (ArrayIndexOutOfBoundsException e) {
// Expected
}
try {
attrs.removeAttribute(3);
fail("ArrayIndexOutOfBoundsException expected");
} catch (ArrayIndexOutOfBoundsException e) {
// Expected
}
}
use of org.xml.sax.ext.Attributes2Impl in project robovm by robovm.
the class Attributes2ImplTest method testSetAttributes.
public void testSetAttributes() {
// Ordinary case with Attributes2Impl
Attributes2Impl attrs = new Attributes2Impl();
attrs.addAttribute("", "", "john", "string", "doe");
attrs.setAttributes(empty);
assertEquals(0, attrs.getLength());
attrs.setAttributes(multi);
for (int i = 0; i < multi.getLength(); i++) {
assertEquals(multi.getURI(i), attrs.getURI(i));
assertEquals(multi.getLocalName(i), attrs.getLocalName(i));
assertEquals(multi.getQName(i), attrs.getQName(i));
assertEquals(multi.getType(i), attrs.getType(i));
assertEquals(multi.getValue(i), attrs.getValue(i));
assertEquals(multi.isDeclared(i), attrs.isDeclared(i));
assertEquals(multi.isSpecified(i), attrs.isSpecified(i));
}
attrs.setAttributes(empty);
assertEquals(0, attrs.getLength());
// Ordinary case with AttributesImpl
attrs.setAttributes(new AttributesImpl(multi));
assertEquals(multi.getLength(), attrs.getLength());
for (int i = 0; i < multi.getLength(); i++) {
assertEquals(multi.getURI(i), attrs.getURI(i));
assertEquals(multi.getLocalName(i), attrs.getLocalName(i));
assertEquals(multi.getQName(i), attrs.getQName(i));
assertEquals(multi.getType(i), attrs.getType(i));
assertEquals(multi.getValue(i), attrs.getValue(i));
assertEquals(true, attrs.isDeclared(i));
assertEquals(true, attrs.isSpecified(i));
}
// Special case with CDATA
attrs.setAttributes(new AttributesImpl(cdata));
assertEquals(1, attrs.getLength());
assertEquals(false, attrs.isDeclared(0));
assertEquals(true, attrs.isSpecified(0));
// null case
try {
attrs.setAttributes(null);
fail("NullPointerException expected");
} catch (NullPointerException e) {
// Expected
}
}
use of org.xml.sax.ext.Attributes2Impl in project robovm by robovm.
the class Attributes2ImplTest method testAttributes2ImplAttributes.
public void testAttributes2ImplAttributes() {
// Ordinary case with Attributes2Impl
Attributes2Impl attrs = new Attributes2Impl(multi);
assertEquals(multi.getLength(), attrs.getLength());
for (int i = 0; i < multi.getLength(); i++) {
assertEquals(multi.getURI(i), attrs.getURI(i));
assertEquals(multi.getLocalName(i), attrs.getLocalName(i));
assertEquals(multi.getQName(i), attrs.getQName(i));
assertEquals(multi.getType(i), attrs.getType(i));
assertEquals(multi.getValue(i), attrs.getValue(i));
assertEquals(multi.isDeclared(i), attrs.isDeclared(i));
assertEquals(multi.isSpecified(i), attrs.isSpecified(i));
}
attrs = new Attributes2Impl(empty);
assertEquals(0, attrs.getLength());
// Ordinary case with AttributesImpl
attrs = new Attributes2Impl(new AttributesImpl(multi));
assertEquals(multi.getLength(), attrs.getLength());
for (int i = 0; i < multi.getLength(); i++) {
assertEquals(multi.getURI(i), attrs.getURI(i));
assertEquals(multi.getLocalName(i), attrs.getLocalName(i));
assertEquals(multi.getQName(i), attrs.getQName(i));
assertEquals(multi.getType(i), attrs.getType(i));
assertEquals(multi.getValue(i), attrs.getValue(i));
assertEquals(true, attrs.isDeclared(i));
assertEquals(true, attrs.isSpecified(i));
}
// Special case with CDATA
attrs = new Attributes2Impl(new AttributesImpl(cdata));
assertEquals(1, attrs.getLength());
assertEquals(false, attrs.isDeclared(0));
assertEquals(true, attrs.isSpecified(0));
// null case
try {
attrs = new Attributes2Impl(null);
fail("NullPointerException expected");
} catch (NullPointerException e) {
// Expected
}
}
Aggregations