/** test that we can extract a proper Map from a PrefixMapping */ public void testPrefixMappingMap() { PrefixMapping ns = getCrispyRope(); Map<String, String> map = ns.getNsPrefixMap(); assertEquals( "map should have two elements", 2, map.size() ); assertEquals( crispURI, map.get( "crisp" ) ); assertEquals( "scheme:rope/string#", map.get( "rope" ) ); }
/** test that we can extract a proper Map from a PrefixMapping */ public void testPrefixMappingMap() { PrefixMapping ns = getCrispyRope(); Map<String, String> map = ns.getNsPrefixMap(); assertEquals( "map should have two elements", 2, map.size() ); assertEquals( crispURI, map.get( "crisp" ) ); assertEquals( "scheme:rope/string#", map.get( "rope" ) ); }
private void checkContainsMapping( PrefixMapping b ) { assertEquals( crispURI, b.getNsPrefixURI( "crisp") ); assertEquals( ropeURI, b.getNsPrefixURI( "rope") ); assertEquals( butterURI, b.getNsPrefixURI( "butter") ); }
public static void testShortForm( String title, PrefixMapping ns ) { ns.setNsPrefix( "crisp", crispURI ); ns.setNsPrefix( "butter", butterURI ); assertEquals( title, "", ns.shortForm( "" ) ); assertEquals( title, ropeURI, ns.shortForm( ropeURI ) ); assertEquals( title, "crisp:tail", ns.shortForm( crispURI + "tail" ) ); assertEquals( title, "butter:here:we:are", ns.shortForm( butterURI + "here:we:are" ) ); }
public void testNumPrefixes() { String hURI = "http://test.prefixes/prefix#"; PrefixMapping A = getMapping(); assertEquals(0, A.numPrefixes()) ; A.setNsPrefix( "hr", hURI ); assertEquals(1, A.numPrefixes()) ; }
protected void testEquals( String S, String T, boolean expected, PrefixMapping A, PrefixMapping B ) { fill( A, S ); fill( B, T ); String title = "usual: '" + S + "', testing: '" + T + "', should be " + (expected ? "equal" : "different"); assertEquals( title, expected, A.samePrefixMappingAs( B ) ); assertEquals( title, expected, B.samePrefixMappingAs( A ) ); }
public void testClear() { String hURI = "http://test.remove.prefixes/prefix#"; String bURI = "http://other.test.remove.prefixes/prefix#"; PrefixMapping A = getMapping(); A.setNsPrefix( "hr", hURI ); A.setNsPrefix( "br", bURI ); A.clearNsPrefixMap() ; assertEquals( null, A.getNsPrefixURI( "hr" ) ); assertEquals( null, A.getNsPrefixURI( "br" ) ); assertEquals( null, A.getNsURIPrefix(hURI) ) ; assertEquals( null, A.getNsURIPrefix(bURI) ) ; }
public void testNumPrefixes() { String hURI = "http://test.prefixes/prefix#"; PrefixMapping A = getMapping(); assertEquals(0, A.numPrefixes()) ; A.setNsPrefix( "hr", hURI ); assertEquals(1, A.numPrefixes()) ; }
protected void testEquals( String S, String T, boolean expected, PrefixMapping A, PrefixMapping B ) { fill( A, S ); fill( B, T ); String title = "usual: '" + S + "', testing: '" + T + "', should be " + (expected ? "equal" : "different"); assertEquals( title, expected, A.samePrefixMappingAs( B ) ); assertEquals( title, expected, B.samePrefixMappingAs( A ) ); }
public void testSecondPrefixRetainsExistingMap() { PrefixMapping A = getMapping(); A.setNsPrefix( "a", crispURI ); A.setNsPrefix( "b", crispURI ); assertEquals( crispURI, A.getNsPrefixURI( "a" ) ); assertEquals( crispURI, A.getNsPrefixURI( "b" ) ); }
public void testNoQNameNoPrefix() { PrefixMapping ns = getMapping(); String alphaURI = "http://seasonal.song/preamble/"; ns.setNsPrefix( "alpha", alphaURI ); assertEquals( null, ns.qnameFor( "eg:rowboat" ) ); }
/** The empty prefix is specifically allowed [for the default namespace]. */ public void testEmptyPrefix() { PrefixMapping pm = getMapping(); pm.setNsPrefix( "", crispURI ); assertEquals( crispURI, pm.getNsPrefixURI( "" ) ); }
public void testNoQNameNoPrefix() { PrefixMapping ns = getMapping(); String alphaURI = "http://seasonal.song/preamble/"; ns.setNsPrefix( "alpha", alphaURI ); assertEquals( null, ns.qnameFor( "eg:rowboat" ) ); }
public void testNoQNameBadLocal() { PrefixMapping ns = getMapping(); String alphaURI = "http://seasonal.song/preamble/"; ns.setNsPrefix( "alpha", alphaURI ); assertEquals( null, ns.qnameFor( alphaURI + "12345" ) ); }
public void testRemovePrefix() { String hURI = "http://test.remove.prefixes/prefix#"; String bURI = "http://other.test.remove.prefixes/prefix#"; PrefixMapping A = getMapping(); A.setNsPrefix( "hr", hURI ); A.setNsPrefix( "br", bURI ); A.removeNsPrefix( "hr" ); assertEquals( null, A.getNsPrefixURI( "hr" ) ); assertEquals( bURI, A.getNsPrefixURI( "br" ) ); }
public void testEasyQName() { PrefixMapping ns = getMapping(); String alphaURI = "http://seasonal.song/preamble/"; ns.setNsPrefix( "alpha", alphaURI ); assertEquals( "alpha:rowboat", ns.qnameFor( alphaURI + "rowboat" ) ); }
public void testRemovePrefix() { String hURI = "http://test.remove.prefixes/prefix#"; String bURI = "http://other.test.remove.prefixes/prefix#"; PrefixMapping A = getMapping(); A.setNsPrefix( "hr", hURI ); A.setNsPrefix( "br", bURI ); A.removeNsPrefix( "hr" ); assertEquals( null, A.getNsPrefixURI( "hr" ) ); assertEquals( bURI, A.getNsPrefixURI( "br" ) ); }
public void testSecondPrefixReplacesReverseMap() { PrefixMapping A = getMapping(); A.setNsPrefix( "a", crispURI ); A.setNsPrefix( "b", crispURI ); assertEquals( "b", A.getNsURIPrefix( crispURI ) ); }
public void testSecondPrefixReplacesReverseMap() { PrefixMapping A = getMapping(); A.setNsPrefix( "a", crispURI ); A.setNsPrefix( "b", crispURI ); assertEquals( "b", A.getNsURIPrefix( crispURI ) ); }
/** Test that the empty prefix does not wipe an existing prefix for the same URI. */ public void testEmptyDoesNotWipeURI() { PrefixMapping pm = getMapping(); pm.setNsPrefix( "frodo", ropeURI ); pm.setNsPrefix( "", ropeURI ); assertEquals( ropeURI, pm.getNsPrefixURI( "frodo" ) ); }