1 16 17 18 package org.apache.commons.betwixt.strategy; 19 20 import org.apache.commons.betwixt.AbstractTestCase; 21 22 26 public class TestNamespaces extends AbstractTestCase { 27 28 public TestNamespaces(String name) { 29 super(name); 30 } 31 32 public void testNamespacePrefixMapper() { 33 NamespacePrefixMapper mapper = new NamespacePrefixMapper(); 34 mapper.setPrefix("http://www.w3.org/2001/XMLSchema", "xsd"); 35 assertEquals("Expected prefix set earlier", "xsd", mapper.getPrefix("http://www.w3.org/2001/XMLSchema")); 36 } 37 38 public void testNamespacePrefixMapperPrefixGeneration() { 39 NamespacePrefixMapper mapper = new NamespacePrefixMapper(); 40 mapper.setPrefix("http://www.w3.org/2001/XMLSchema", "xsd"); 41 assertNotNull("Expected prefix assigned not to be null", mapper.getPrefix("http://jakarta.apache.org/commons/Betwixt")); 42 } 43 44 public void testNamespacePrefixMapperMatchingPrefix() { 45 NamespacePrefixMapper mapper = new NamespacePrefixMapper(); 46 mapper.setPrefix("http://www.w3.org/2001/XMLSchema", "bt1"); 47 String prefix = mapper.getPrefix("http://jakarta.apache.org/commons/Betwixt"); 48 assertFalse("Generated should not clash", prefix.equals(mapper.getPrefix("http://www.w3.org/2001/XMLSchema"))); 49 } 50 } 51 | Popular Tags |