@Test public void testSetAttributeNodeNS() { Element node = mock(Element.class); String namespaceURI = "uri1"; String qualifiedName = "fqn1"; String value = "nodeValue1"; GwtDOMHandler.GwtDOMAttr gwtAttr = new GwtDOMHandler.GwtDOMAttr(namespaceURI, qualifiedName); gwtAttr.setNodeValue(value); GwtDOMHandler.GwtDOMAttr attr = spy(gwtAttr); Attr r = mock(Attr.class); when(node.getAttributeNode(eq(qualifiedName))).thenReturn(r); Attr result = tested.setAttributeNodeNS(node, attr); assertEquals(r, result); verify(node, times(1)).setAttribute(eq(qualifiedName), eq(value)); verify(attr, times(1)).setNode(eq(node)); }
public Attr setAttributeNodeNS(final Node element, final Attr attr) { if (attr instanceof GwtDOMAttr) { ((GwtDOMAttr) attr).setNode(element); } return setAttributeNS(element, attr.getNamespaceURI(), attr.getName(), attr.getValue()); }
GwtDOMHandler { public Attr setAttributeNodeNS(final Node element, final Attr attr) { if (attr instanceof GwtDOMAttr) { ((GwtDOMAttr) attr).setNode(element); } return setAttributeNS(element, attr.getNamespaceURI(), attr.getName(), attr.getValue()); } }
GwtDOMHandler { public Attr setAttributeNodeNS(final Node element, final Attr attr) { if (attr instanceof GwtDOMAttr) { ((GwtDOMAttr) attr).setNode(element); } return setAttributeNS(element, attr.getNamespaceURI(), attr.getName(), attr.getValue()); } GwtDOMHandler(final Document document); }
GwtDOMHandler { public Attr setAttributeNodeNS(final Node element, final Attr attr) { if (attr instanceof GwtDOMAttr) { ((GwtDOMAttr) attr).setNode(element); } return setAttributeNS(element, attr.getNamespaceURI(), attr.getName(), attr.getValue()); } GwtDOMHandler(final Document document); Element createElement(final String tagName); Text createTextNode(final String data); Comment createComment(final String data); CDATASection createCDATASection(final String data); ProcessingInstruction createProcessingInstruction(final String target,
                                                             final String data); Element createElementNS(final String namespaceURI,
                                   final String qualifiedName); Attr createAttributeNS(final String namespaceURI,
                                  final String qualifiedName); Attr setAttributeNS(final Node node,
                               final String namespaceURI,
                               final String qualifiedName,
                               final String value); Attr setAttributeNodeNS(final Node element,
                                   final Attr attr); static Node getNamedItem(NamedNodeMap map,
                                    String uri,
                                    String localName); Document getDocument(); }
GwtDOMHandler { public Attr setAttributeNodeNS(final Node element, final Attr attr) { if (attr instanceof GwtDOMAttr) { ((GwtDOMAttr) attr).setNode(element); } return setAttributeNS(element, attr.getNamespaceURI(), attr.getName(), attr.getValue()); } GwtDOMHandler(final Document document); Element createElement(final String tagName); Text createTextNode(final String data); Comment createComment(final String data); CDATASection createCDATASection(final String data); ProcessingInstruction createProcessingInstruction(final String target,
                                                             final String data); Element createElementNS(final String namespaceURI,
                                   final String qualifiedName); Attr createAttributeNS(final String namespaceURI,
                                  final String qualifiedName); Attr setAttributeNS(final Node node,
                               final String namespaceURI,
                               final String qualifiedName,
                               final String value); Attr setAttributeNodeNS(final Node element,
                                   final Attr attr); static Node getNamedItem(NamedNodeMap map,
                                    String uri,
                                    String localName); Document getDocument();  }