@Test public void testRemoveNameSpacePrefix() { String temp = "this.is.a.namespace"; String result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("namespace", result); temp = "this.namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("namespace", result); temp = "namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("namespace", result); temp = "this_is-a-namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("this_is-a-namespace", result); }
@Test public void testRemoveXMLNameSpacePrefix() { String temp = "j:namespace"; String result = PropertiesUtils.removeXmlNamespacePrefix(temp); assertEquals("namespace", result); temp = "this-namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("this-namespace", result); temp = "namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("namespace", result); }
public static Map removeNamespaces(Map properties) { HashMap props = new HashMap(properties.size()); Map.Entry entry; for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) { entry = (Map.Entry) iter.next(); props.put(removeNamespacePrefix((String) entry.getKey()), entry.getValue()); } return props; }
@Test public void testRemoveNameSpacePrefix() { String temp = "this.is.a.namespace"; String result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("namespace", result); temp = "this.namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("namespace", result); temp = "namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("namespace", result); temp = "this_is-a-namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("this_is-a-namespace", result); }
@Test public void testRemoveXMLNameSpacePrefix() { String temp = "j:namespace"; String result = PropertiesUtils.removeXmlNamespacePrefix(temp); assertEquals("namespace", result); temp = "this-namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("this-namespace", result); temp = "namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("namespace", result); }