PrologHandler implements Handler { public void addPrefix(String pfx, String uri) { query.setPrefix(canonicalPfx(pfx), uri); } PrologHandler(Query query); void setBase(IRIResolver resolver); void setBase(String base); void addPrefix(String pfx, String uri); void clearPrefixes(); void addPrefixes(Map<String, String> prefixes); PrefixMapping getPrefixes(); ExprFactory getExprFactory(); void addPrefixes(PrefixMapping prefixes); void addAll(PrologHandler pfxHandler); @Override void setVars(Map<Var, Node> values); @Override void build();  }
@Test public void testAddPrefixString() { handler.addPrefix("pfx", "uri"); String[] lst = byLine(query.toString()); assertContainsRegex(PREFIX+"pfx:"+SPACE+uri("uri"), lst); }
@Test public void testAddPrefixStringWithColon() { handler.addPrefix("pfx:", "uri"); String[] lst = byLine(query.toString()); assertContainsRegex(PREFIX+"pfx:"+SPACE+uri("uri"), lst); }
@Test public void testAddDuplicatePrefix() { handler.addPrefix("pfx", "uri"); handler.addPrefix("pfx", "uri"); String[] lst = byLine(query.toString()); assertContainsRegex("PREFIX\\s+pfx:\\s+\\<uri\\>", lst); }