@Test
public void testComposeSolutions() throws Exception {

    HashMap<String, String> map1, map2;
    Bindings<String> b1, b2;
    Solution<String> ps1, ps2;
    map1 = new HashMap<>();
    map1.put("x", "red");
    map1.put("z", "blue");
    b1 = new Bindings<>(map1, vars);
    ps1 = new Solution<>(3, 0, b1, exp);
    // add an incompatible solution
    map2 = new HashMap<>();
    map2.put("y", "green");
    b2 = new Bindings<>(map2, vars);
    ps2 = new Solution<>(ps1, 2, b2);
    index.add(ps2, now);
    assertEquals(0, count(index.composeSolutions("x", "red", ps1, now)));
    // add two compatible solutions.  Both appear in the composed iterator.
    map2 = new HashMap<>();
    map2.put("x", "red");
    map2.put("y", "green");
    b2 = new Bindings<>(map2, vars);
    ps2 = new Solution<>(3, 2, b2, exp);
    index.add(ps2, now);
    assertEquals(1, count(index.composeSolutions("x", "red", ps1, now)));
    map2 = new HashMap<>();
    map2.put("x", "red");
    map2.put("y", "hazel");
    b2 = new Bindings<>(map2, vars);
    ps2 = new Solution<>(3, 2, b2, exp);
    index.add(ps2, now);
    assertEquals(2, count(index.composeSolutions("x", "red", ps1, now)));
}