PrologHandler implements Handler { public void addPrefixes(Map<String, String> prefixes) { for (Map.Entry<String, String> e : prefixes.entrySet()) { addPrefix(e.getKey(), e.getValue()); } } 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 testAddPrefixes() { Map<String, String> map = new HashMap<>(); map.put("pfx", "uri"); map.put("pfx2", "uri2"); handler.addPrefixes(map); String[] lst = byLine(query.toString()); assertContainsRegex(PREFIX+"pfx:"+SPACE+uri("uri"), lst); assertContainsRegex(PREFIX+"pfx2:"+SPACE+uri("uri2"), lst); }
@Test public void testAddPrefixesWithColon() { Map<String, String> map = new HashMap<>(); map.put("pfx:", "uri"); map.put("pfx2", "uri2"); handler.addPrefixes(map); String[] lst = byLine(query.toString()); assertContainsRegex(PREFIX+"pfx:"+SPACE+uri("uri"), lst); assertContainsRegex(PREFIX+"pfx2:"+SPACE+uri("uri2"), lst); }