/** test that a PrefixMapping maps names to URIs. The names and URIs are all fully distinct - overlapping names/uris are dealt with in other tests. */ public void testPrefixMappingMapping() { String toast = "ftp://ftp.nowhere.not/"; assertDiffer( "crisp and toast must differ", crispURI, toast ); /* */ PrefixMapping ns = getMapping(); assertEquals( "crisp should be unset", null, ns.getNsPrefixURI( "crisp" ) ); assertEquals( "toast should be unset", null, ns.getNsPrefixURI( "toast" ) ); assertEquals( "butter should be unset", null, ns.getNsPrefixURI( "butter" ) ); /* */ ns.setNsPrefix( "crisp", crispURI ); assertEquals( "crisp should be set", crispURI, ns.getNsPrefixURI( "crisp" ) ); assertEquals( "toast should still be unset", null, ns.getNsPrefixURI( "toast" ) ); assertEquals( "butter should still be unset", null, ns.getNsPrefixURI( "butter" ) ); /* */ ns.setNsPrefix( "toast", toast ); assertEquals( "crisp should be set", crispURI, ns.getNsPrefixURI( "crisp" ) ); assertEquals( "toast should be set", toast, ns.getNsPrefixURI( "toast" ) ); assertEquals( "butter should still be unset", null, ns.getNsPrefixURI( "butter" ) ); }
/** test that a PrefixMapping maps names to URIs. The names and URIs are all fully distinct - overlapping names/uris are dealt with in other tests. */ public void testPrefixMappingMapping() { String toast = "ftp://ftp.nowhere.not/"; assertDiffer( "crisp and toast must differ", crispURI, toast ); /* */ PrefixMapping ns = getMapping(); assertEquals( "crisp should be unset", null, ns.getNsPrefixURI( "crisp" ) ); assertEquals( "toast should be unset", null, ns.getNsPrefixURI( "toast" ) ); assertEquals( "butter should be unset", null, ns.getNsPrefixURI( "butter" ) ); /* */ ns.setNsPrefix( "crisp", crispURI ); assertEquals( "crisp should be set", crispURI, ns.getNsPrefixURI( "crisp" ) ); assertEquals( "toast should still be unset", null, ns.getNsPrefixURI( "toast" ) ); assertEquals( "butter should still be unset", null, ns.getNsPrefixURI( "butter" ) ); /* */ ns.setNsPrefix( "toast", toast ); assertEquals( "crisp should be set", crispURI, ns.getNsPrefixURI( "crisp" ) ); assertEquals( "toast should be set", toast, ns.getNsPrefixURI( "toast" ) ); assertEquals( "butter should still be unset", null, ns.getNsPrefixURI( "butter" ) ); }