public void testUseEasyPrefix() { testUseEasyPrefix( "prefix mapping impl", getMapping() ); testShortForm( "prefix mapping impl", getMapping() ); }
public void testEqualsBase( String S, String T, boolean expected ) { testEquals( S, T, expected, getMapping(), getMapping() ); testEquals( S, T, expected, PrefixMapping.Factory.create(), getMapping() ); }
private PrefixMapping getCrispyRope() { PrefixMapping ns = getMapping(); ns.setNsPrefix( "crisp", crispURI); ns.setNsPrefix( "rope", ropeURI ); return ns; }
private PrefixMapping getCrispyRope() { PrefixMapping ns = getMapping(); ns.setNsPrefix( "crisp", crispURI); ns.setNsPrefix( "rope", ropeURI ); return ns; }
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 testNullURITrapped() { try { getMapping().setNsPrefix( "xy", null ); fail( "should trap null URI in setNsPrefix" ); } catch (NullPointerException e) { pass(); } }
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 testNullURITrapped() { try { getMapping().setNsPrefix( "xy", null ); fail( "should trap null URI in setNsPrefix" ); } catch (NullPointerException e) { pass(); } }
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 testSecondPrefixReplacesReverseMap() { PrefixMapping A = getMapping(); A.setNsPrefix( "a", crispURI ); A.setNsPrefix( "b", crispURI ); assertEquals( "b", A.getNsURIPrefix( crispURI ) ); }
public void testNoMapping() { String hURI = "http://test.prefixes/prefix#"; PrefixMapping A = getMapping(); assertTrue(A.hasNoMappings()) ; A.setNsPrefix( "hr", hURI ); assertFalse(A.hasNoMappings()) ; }
public void testNumPrefixes() { String hURI = "http://test.prefixes/prefix#"; PrefixMapping A = getMapping(); assertEquals(0, A.numPrefixes()) ; A.setNsPrefix( "hr", hURI ); assertEquals(1, A.numPrefixes()) ; }
public void testReturnsSelf() { PrefixMapping A = getMapping(); assertSame( A, A.setNsPrefix( "crisp", crispURI ) ); assertSame( A, A.setNsPrefixes( A ) ); assertSame( A, A.setNsPrefixes( new HashMap<String, String>() ) ); assertSame( A, A.removeNsPrefix( "rhubarb" ) ); }
public void testReturnsSelf() { PrefixMapping A = getMapping(); assertSame( A, A.setNsPrefix( "crisp", crispURI ) ); assertSame( A, A.setNsPrefixes( A ) ); assertSame( A, A.setNsPrefixes( new HashMap<String, String>() ) ); assertSame( A, A.removeNsPrefix( "rhubarb" ) ); }
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 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 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 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) ) ; }