### Question:
FuzzyValueCombination { public static List<Map<TblColRef, String>> calculate(Map<TblColRef, Set<String>> fuzzyValues, long cap) { Dim[] dims = toDims(fuzzyValues); capDims(dims, cap); return combination(dims); }  static List<Map<TblColRef, String>> calculate(Map<TblColRef, Set<String>> fuzzyValues, long cap);  }### Answer:
@Test public void testBasics() { System.out.println("test basics ============================================================================"); Map<TblColRef, Set<String>> values = Maps.newHashMap(); values.put(col1, set("a", "b", "c")); values.put(col2, set("x", "y", "z")); List<Map<TblColRef, String>> result = FuzzyValueCombination.calculate(values, 10); for (Map<TblColRef, String> item : result) { System.out.println(item); } assertEquals(9, result.size()); }
@Test public void testSomeNull() { System.out.println("test some null ============================================================================"); Map<TblColRef, Set<String>> values = Maps.newHashMap(); values.put(col1, set("a", "b", "c")); values.put(col2, set()); values.put(col3, set("x", "y", "z")); List<Map<TblColRef, String>> result = FuzzyValueCombination.calculate(values, 10); for (Map<TblColRef, String> item : result) { System.out.println(item); } assertEquals(9, result.size()); }
@Test public void testAllNulls() { System.out.println("test all nulls ============================================================================"); Map<TblColRef, Set<String>> values = Maps.newHashMap(); values.put(col1, set()); values.put(col2, set()); values.put(col3, set()); List<Map<TblColRef, String>> result = FuzzyValueCombination.calculate(values, 10); for (Map<TblColRef, String> item : result) { System.out.println(item); } assertEquals(0, result.size()); }
@Test public void testCap() { System.out.println("test cap ============================================================================"); Map<TblColRef, Set<String>> values = Maps.newHashMap(); values.put(col1, set("1", "2", "3", "4")); values.put(col2, set("a", "b", "c")); values.put(col3, set("x", "y", "z")); List<Map<TblColRef, String>> result = FuzzyValueCombination.calculate(values, 10); for (Map<TblColRef, String> item : result) { System.out.println(item); } assertEquals(9, result.size()); }