### Question:
CandidateGenerator { public List<SimpleInd> createCombinedCandidates(List<SimpleInd> inds, boolean isCombineNull, AbstractColumnStore[] stores) { Map<SimpleColumnCombination, SimpleColumnCombination> columnCombinations = new HashMap<>(); if (!isCombineNull) { inds = inds.stream() .filter(ind -> { AbstractColumnStore store = stores[ind.left.getTable()]; for (int column : ind.left.getColumns()) { if (store.isNullColumn(column)) return false; } return true; }) .collect(Collectors.toList()); } List<SimpleInd> newIndCandidates = new ArrayList<>(); HashSet<SimpleInd> lastResults = new HashSet<>(inds); inds.sort(SimpleInd.prefixBlockComparator); for (int i = 0; i < inds.size(); i++) { SimpleInd a = inds.get(i); for (int j = i + 1; j < inds.size(); j++) { SimpleInd b = inds.get(j); if (!a.left.startsWith(b.left) || !a.right.startsWith(b.right)) break; if (a.left.lastColumn() == b.left.lastColumn() || a.right.lastColumn() == b.right.lastColumn()) { continue; } SimpleInd newCandidate = a.combineWith(b, columnCombinations); if (isPotentiallyValid(newCandidate, lastResults)) { newIndCandidates.add(newCandidate); } } } return newIndCandidates; }  List<SimpleInd> createCombinedCandidates(List<SimpleInd> inds, boolean isCombineNull, AbstractColumnStore[] stores);  }### Answer:
@Test public void testCreateCombinedCandidatesTrinary() throws Exception { List<SimpleInd> inds = Arrays.asList( SimpleInd.left(TABLE, 0, 1).right(TABLE, 3, 4), SimpleInd.left(TABLE, 1, 2).right(TABLE, 4, 5), SimpleInd.left(TABLE, 0, 2).right(TABLE, 3, 5) ); List<SimpleInd> candidates = gen.createCombinedCandidates(inds, true, null); assertThat(candidates, contains(SimpleInd.left(TABLE, 0, 1, 2).right(TABLE, 3, 4, 5))); }
@Test public void testCreateCombinedCandidatesBinary() throws Exception { List<SimpleInd> candidates = gen.createCombinedCandidates(Arrays.asList( SimpleInd.left(TABLE, 0).right(TABLE, 3), SimpleInd.left(TABLE, 1).right(TABLE, 4) ), true, null); assertThat(candidates, contains(SimpleInd.left(TABLE, 0, 1).right(TABLE, 3, 4))); }