static Attributes copy(Attributes atts) { return new Attributes2Impl(atts); }
Attributes2Impl attrs = new Attributes2Impl(attributes); attrs.addAttribute("http://myNamespace", "location", "myns:location", "CDATA", location); super.startElement(uri, localName, qName, attrs);
Attributes2Impl a2 = new Attributes2Impl();
@Test public void testStartElementThrowsNullPointerException() throws Throwable { Attributes atts = new Attributes2Impl(); try { xMLPackager.startElement("testXMLPackagerNs", null, "testXMLPackagerQName", atts); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); } }
@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()); } }
@Test public void testGenericValidatorContentHandlerStartElementThrowsSAXException2() throws Throwable { GenericValidatingPackager.GenericValidatorContentHandler genericValidatorContentHandler = new GenericValidatingPackager().new GenericValidatorContentHandler(); Attributes atts = new Attributes2Impl(); try { genericValidatorContentHandler.startElement("testGenericValidatorContentHandlerNamespaceURI", null, "testGenericValidatorContentHandlerQName", atts); fail("Expected SAXException to be thrown"); } catch (SAXException ex) { assertNull("ex.getMessage()", ex.getMessage()); assertNull("ex.getException().getMessage()", ex.getException().getMessage()); } }
@Test public void testGenericContentHandlerStartElementThrowsSAXException2() throws Throwable { GenericPackager.GenericContentHandler genericContentHandler = new GenericSubFieldPackager().new GenericContentHandler(); Attributes atts = new Attributes2Impl(); try { genericContentHandler .startElement("testGenericContentHandlerNamespaceURI", null, "testGenericContentHandlerQName", atts); fail("Expected SAXException to be thrown"); } catch (SAXException ex) { assertNull("ex.getMessage()", ex.getMessage()); assertNull("ex.getException().getMessage()", ex.getException().getMessage()); } }
@Test public void testGenericContentHandlerStartElementThrowsSAXException4() throws Throwable { GenericPackager.GenericContentHandler genericContentHandler = new X92GenericPackager().new GenericContentHandler(); Attributes atts = new Attributes2Impl(); try { genericContentHandler.startElement("testGenericContentHandlerNamespaceURI", "isofieldpackager", "testGenericContentHandlerQName", atts); fail("Expected SAXException to be thrown"); } catch (SAXException ex) { assertEquals("ex.getMessage()", "null", ex.getMessage()); assertEquals("ex.getException().getMessage()", "null", ex.getException().getMessage()); } }
@Test public void testGenericContentHandlerEndElementThrowsClassCastException() throws Throwable { GenericPackager.GenericContentHandler genericContentHandler = new GenericPackager().new GenericContentHandler(); genericContentHandler.startDocument(); Attributes atts = new AttributesImpl(new Attributes2Impl()); genericContentHandler.startElement("testGenericContentHandlerNamespaceURI", "isopackager", "testGenericContentHandlerQName", atts); genericContentHandler.startElement("testGenericContentHandlerNamespaceURI1", "isopackager", "testGenericContentHandlerQName1", atts); try { genericContentHandler.endElement("testGenericContentHandlerNamespaceURI", "isofieldpackager", "testGenericContentHandlerQName"); fail("Expected ClassCastException to be thrown"); } catch (ClassCastException ex) { assertEquals("ex.getClass()", ClassCastException.class, ex.getClass()); } }
@Before public void onSetup() throws ISOException, NoSuchFieldException { // PrintStream p = new PrintStream(new ByteArrayOutputStream()) xMLPackager = new XMLPackager(); atts = new Attributes2Impl(); logger = new Logger(); logger.addListener(new SimpleLogListener()); isoMsg = xMLPackager.createISOMsg(); xMLPackager.setLogger(logger, xMLPackager.getClass().getName()); isoMsg.setPackager(xMLPackager); }
@Test public void testGenericValidatorContentHandlerStartElement1() throws Throwable { GenericValidatingPackager.GenericValidatorContentHandler genericValidatorContentHandler = new GenericValidatingPackager().new GenericValidatorContentHandler(); Attributes atts = new Attributes2Impl(); genericValidatorContentHandler.startElement("testGenericValidatorContentHandlerNamespaceURI", "testGenericValidatorContentHandlerLocalName", "testGenericValidatorContentHandlerQName", atts); }