### Question:
StaxUtils { public static boolean isStaxSource(Source source) { return ((source instanceof StaxSource) || (jaxp14Available && Jaxp14StaxHandler.isStaxSource(source))); }  static Source createCustomStaxSource(XMLStreamReader streamReader); static Source createStaxSource(XMLStreamReader streamReader); static Source createCustomStaxSource(XMLEventReader eventReader); static Source createStaxSource(XMLEventReader eventReader); static boolean isStaxSource(Source source); static boolean isStaxSourceClass(Class<? extends Source> clazz); static Result createCustomStaxResult(XMLStreamWriter streamWriter); static Result createStaxResult(XMLStreamWriter streamWriter); static Result createCustomStaxResult(XMLEventWriter eventWriter); static Result createStaxResult(XMLEventWriter eventWriter); static boolean isStaxResult(Result result); static XMLStreamReader getXMLStreamReader(Source source); static XMLEventReader getXMLEventReader(Source source); static XMLStreamWriter getXMLStreamWriter(Result result); static XMLEventWriter getXMLEventWriter(Result result); static ContentHandler createContentHandler(XMLStreamWriter streamWriter); static ContentHandler createContentHandler(XMLEventWriter eventWriter); static XMLReader createXMLReader(XMLStreamReader streamReader); static XMLReader createXMLReader(XMLEventReader eventReader); static XMLStreamReader createEventStreamReader(XMLEventReader eventReader); static XMLStreamWriter createEventStreamWriter(XMLEventWriter eventWriter); static XMLStreamWriter createEventStreamWriter(XMLEventWriter eventWriter, XMLEventFactory eventFactory);  }### Answer:
@Test public void isStaxSourceInvalid() throws Exception { assertFalse("A StAX Source", StaxUtils.isStaxSource(new DOMSource())); assertFalse("A StAX Source", StaxUtils.isStaxSource(new SAXSource())); assertFalse("A StAX Source", StaxUtils.isStaxSource(new StreamSource())); }
@Test public void isStaxSource() throws Exception { XMLInputFactory inputFactory = XMLInputFactory.newInstance(); String expected = "<element/>"; XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(expected)); Source source = StaxUtils.createCustomStaxSource(streamReader); assertTrue("Not a StAX Source", StaxUtils.isStaxSource(source)); }
@Test public void isStaxSourceJaxp14() throws Exception { XMLInputFactory inputFactory = XMLInputFactory.newInstance(); String expected = "<element/>"; XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(expected)); StAXSource source = new StAXSource(streamReader); assertTrue("Not a StAX Source", StaxUtils.isStaxSource(source)); }