use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class AbstractTestPrefixMapping method testPrefixMappingSecret.
/**
test that the Map returned by getNsPrefixMap does not alias (parts of)
the secret internal map of the PrefixMapping
*/
public void testPrefixMappingSecret() {
PrefixMapping ns = getCrispyRope();
Map<String, String> map = ns.getNsPrefixMap();
/* */
map.put("crisp", "with/onions");
map.put("sandwich", "with/cheese");
assertEquals(crispURI, ns.getNsPrefixURI("crisp"));
assertEquals(ropeURI, ns.getNsPrefixURI("rope"));
assertEquals(null, ns.getNsPrefixURI("sandwich"));
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class AbstractTestPrefixMapping method testSecondPrefixDeletedUncoversPreviousMap.
public void testSecondPrefixDeletedUncoversPreviousMap() {
PrefixMapping A = getMapping();
A.setNsPrefix("x", crispURI);
A.setNsPrefix("y", crispURI);
A.removeNsPrefix("y");
assertEquals("x", A.getNsURIPrefix(crispURI));
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class AbstractTestPrefixMapping method testNoQNameBadLocal.
public void testNoQNameBadLocal() {
PrefixMapping ns = getMapping();
String alphaURI = "http://seasonal.song/preamble/";
ns.setNsPrefix("alpha", alphaURI);
assertEquals(null, ns.qnameFor(alphaURI + "12345"));
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class AbstractTestPrefixMapping method testCheckNames.
/**
Test that various illegal names are trapped.
*/
public void testCheckNames() {
PrefixMapping ns = getMapping();
for (String bad : badNames) {
try {
ns.setNsPrefix(bad, crispURI);
fail("'" + bad + "' is an illegal prefix and should be trapped");
} catch (PrefixMapping.IllegalPrefixException e) {
pass();
}
}
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class AbstractTestPrefixMapping method testReturnsSelf.
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"));
}
Aggregations