ConstructHandler implements Handler { public void addAll(ConstructHandler handler) { constructs.addAll(handler.constructs); query.setConstructTemplate(new Template(BasicPattern.wrap(constructs))); } ConstructHandler(Query query); void addConstruct(Triple t); void addAll(ConstructHandler handler); @Override void setVars(Map<Var, Node> values); @Override void build();  }
@Test public void testAddAll() { Triple t = new Triple(NodeFactory.createURI("one"), NodeFactory.createURI("two"), NodeFactory.createURI("three")); ConstructHandler handler2 = new ConstructHandler(new Query()); handler2.addConstruct(t); handler.addAll(handler2); Template template = query.getConstructTemplate(); assertNotNull(template); List<Triple> lst = template.getTriples(); assertEquals(1, lst.size()); assertEquals(t, lst.get(0)); }