DatasetHandler implements Handler { public void addAll(DatasetHandler datasetHandler) { from(datasetHandler.query.getGraphURIs()); fromNamed(datasetHandler.query.getNamedGraphURIs()); } DatasetHandler(Query query); void addAll(DatasetHandler datasetHandler); void fromNamed(String graphName); void fromNamed(Collection<String> graphNames); void from(String graphName); void from(Collection<String> graphNames); @Override void setVars(Map<Var, Node> values); @Override void build();  }
@Test public void testAddAll() { DatasetHandler handler2 = new DatasetHandler(new Query()); handler2.from("foo"); handler2.fromNamed("bar"); handler.addAll(handler2); String s = query.toString(); assertTrue(s.contains("FROM <foo>")); assertTrue(s.contains("FROM NAMED <bar>")); }