@Validated @Test public final void testAddDetailEntryUsingQName() throws Exception { Detail detail = createEmptySOAPFault().addDetail(); DetailEntry detailEntry = detail.addDetailEntry(new QName("urn:ns", "mydetail", "p")); assertEquals("urn:ns", detailEntry.getNamespaceURI()); assertEquals("mydetail", detailEntry.getLocalName()); assertEquals("p", detailEntry.getPrefix()); assertSame(detailEntry, detail.getFirstChild()); }
@Validated @Test public final void testAddDetailEntryUsingName() throws Exception { SOAPEnvelope envelope = createSOAPEnvelope(); Detail detail = envelope.addBody().addFault().addDetail(); DetailEntry detailEntry = detail.addDetailEntry(envelope.createName("mydetail", "p", "urn:ns")); assertEquals("urn:ns", detailEntry.getNamespaceURI()); assertEquals("mydetail", detailEntry.getLocalName()); assertEquals("p", detailEntry.getPrefix()); assertSame(detailEntry, detail.getFirstChild()); }
@Validated @Test public final void testCreateDetailEntryUsingCreateElementNS() throws Exception { SOAPFault fault = createEmptySOAPFault(); Detail detail = fault.addDetail(); detail.appendChild(fault.getOwnerDocument().createElementNS("urn:ns", "p:test")); Iterator<?> it = detail.getDetailEntries(); assertTrue(it.hasNext()); // The implementation silently replaces the Element by a DetailEntry DetailEntry detailEntry = (DetailEntry) it.next(); assertEquals("urn:ns", detailEntry.getNamespaceURI()); assertEquals("test", detailEntry.getLocalName()); }