### Question:
SolutionIndex { public Iterator<Solution<T>> getSolutions(final String variable, final T value, final long now) { Set<SolutionGroup<T>> groups = getSolutionGroups(variable, value); return null == groups ? null : new SolutionIterator<>(groups.iterator(), now); } SolutionIndex(final Query.QueryVariables queryVariables,
                         final int totalPatterns); synchronized boolean add(final Solution<T> s, final long now); Iterator<Solution<T>> getSolutions(final String variable, final T value, final long now); Iterator<Solution<T>> getComposableSolutions(final String variable,
                                                        final T value,
                                                        final Solution<T> ps,
                                                        final long now); Iterator<Solution<T>> composeSolutions(final String variable,
                                                  final T value,
                                                  final Solution<T> ps,
                                                  final long now); void joinSolutions(final Solution<T> matchedSolution,
                              final Bindings<T> bindings,
                              final Stack<Solution<T>> solutions,
                              final long now); synchronized int removeExpired(final long now);  }### Answer:
@Test public void testGetSolutions() throws Exception { Solution<String> ps; HashMap<String, String> map1; Bindings<String> b1; assertEquals(0, count(index.getSolutions("x", "red", now))); map1 = new HashMap<>(); map1.put("x", "red"); map1.put("y", "green"); b1 = new Bindings<>(map1, vars); ps = new Solution<>(3, 0, b1, exp); index.add(ps, now); assertEquals(1, count(index.getSolutions("x", "red", now))); assertEquals(0, count(index.getSolutions("x", "green", now))); assertEquals(0, count(index.getSolutions("y", "red", now))); assertEquals(1, count(index.getSolutions("y", "green", now))); map1 = new HashMap<>(); map1.put("z", "blue"); b1 = new Bindings<>(map1, vars); ps = new Solution<>(ps, 1, b1); index.add(ps, now); assertEquals(2, count(index.getSolutions("x", "red", now))); assertEquals(2, count(index.getSolutions("y", "green", now))); assertEquals(1, count(index.getSolutions("z", "blue", now))); map1 = new HashMap<>(); map1.put("x", "red"); map1.put("y", "green"); b1 = new Bindings<>(map1, vars); ps = new Solution<>(3, 1, b1, exp); index.add(ps, now); assertEquals(3, count(index.getSolutions("x", "red", now))); assertEquals(3, count(index.getSolutions("y", "green", now))); ps = new Solution<>(ps, 0); index.add(ps, now); assertEquals(2, count(index.getSolutions("x", "red", now))); assertEquals(2, count(index.getSolutions("y", "green", now))); map1 = new HashMap<>(); map1.put("x", "puce"); map1.put("y", "green"); b1 = new Bindings<>(map1, vars); ps = new Solution<>(3, 0, b1, exp); index.add(ps, now); assertEquals(2, count(index.getSolutions("x", "red", now))); assertEquals(1, count(index.getSolutions("x", "puce", now))); assertEquals(3, count(index.getSolutions("y", "green", now))); }