Code example for Element

Methods: setUserData

0
        assertEquals("http://sales", deluxe.getNamespaceURI());
    } 
 
    public void testUserDataHandlerNotifiedOfRenames() { 
        RecordingHandler handler = new RecordingHandler();
        description.setUserData("a", "apple", handler);
        deluxe.setUserData("b", "banana", handler);
        standard.setUserData("c", "cat", handler);
 
        document.renameNode(deluxe, null, "special");
        document.renameNode(description, null, "desc");
 
        Set<String> expected = new HashSet<String>();
        expected.add(notification(NODE_RENAMED, "a", "apple", description, null));
        expected.add(notification(NODE_RENAMED, "b", "banana", deluxe, null));
        assertEquals(expected, handler.calls);
    } 
 
    public void testRenameToInvalid() { 
        try { 
            document.renameNode(description, null, "xmlns:foo");