@Test public void generateInput_mxWithAndWithout1_with1AlreadyStored() { InputResult result = FuzzyPhoneNumberHelper.generateInput(setOf(US_A, MX_A_1, MX_A), setOf(US_A, MX_A_1)); assertEquals(3, result.getNumbers().size()); assertTrue(result.getNumbers().containsAll(setOf(US_A, MX_A_1, MX_A))); assertTrue(result.getFuzzies().isEmpty()); }
static @NonNull InputResult generateInput(@NonNull Collection<String> testNumbers, @NonNull Collection<String> storedNumbers) { Set<String> allNumbers = new HashSet<>(testNumbers); Map<String, String> fuzzies = new HashMap<>(); for (String number : testNumbers) { if (mx(number)) { String add1 = mxAdd1(number); String strip1 = mxStrip1(number); if (mxMissing1(number) && !storedNumbers.contains(add1) && allNumbers.add(add1)) { fuzzies.put(number, add1); } else if (mxHas1(number) && !storedNumbers.contains(strip1) && allNumbers.add(strip1)) { fuzzies.put(number, strip1); } } } return new InputResult(allNumbers, fuzzies); }
FuzzyPhoneNumberHelper { static @NonNull InputResult generateInput(@NonNull Collection<String> testNumbers, @NonNull Collection<String> storedNumbers) { Set<String> allNumbers = new HashSet<>(testNumbers); Map<String, String> fuzzies = new HashMap<>(); for (String number : testNumbers) { if (mx(number)) { String add1 = mxAdd1(number); String strip1 = mxStrip1(number); if (mxMissing1(number) && !storedNumbers.contains(add1) && allNumbers.add(add1)) { fuzzies.put(number, add1); } else if (mxHas1(number) && !storedNumbers.contains(strip1) && allNumbers.add(strip1)) { fuzzies.put(number, strip1); } } } return new InputResult(allNumbers, fuzzies); } }
FuzzyPhoneNumberHelper { static @NonNull InputResult generateInput(@NonNull Collection<String> testNumbers, @NonNull Collection<String> storedNumbers) { Set<String> allNumbers = new HashSet<>(testNumbers); Map<String, String> fuzzies = new HashMap<>(); for (String number : testNumbers) { if (mx(number)) { String add1 = mxAdd1(number); String strip1 = mxStrip1(number); if (mxMissing1(number) && !storedNumbers.contains(add1) && allNumbers.add(add1)) { fuzzies.put(number, add1); } else if (mxHas1(number) && !storedNumbers.contains(strip1) && allNumbers.add(strip1)) { fuzzies.put(number, strip1); } } } return new InputResult(allNumbers, fuzzies); }  }
FuzzyPhoneNumberHelper { static @NonNull InputResult generateInput(@NonNull Collection<String> testNumbers, @NonNull Collection<String> storedNumbers) { Set<String> allNumbers = new HashSet<>(testNumbers); Map<String, String> fuzzies = new HashMap<>(); for (String number : testNumbers) { if (mx(number)) { String add1 = mxAdd1(number); String strip1 = mxStrip1(number); if (mxMissing1(number) && !storedNumbers.contains(add1) && allNumbers.add(add1)) { fuzzies.put(number, add1); } else if (mxHas1(number) && !storedNumbers.contains(strip1) && allNumbers.add(strip1)) { fuzzies.put(number, strip1); } } } return new InputResult(allNumbers, fuzzies); }   }
FuzzyPhoneNumberHelper { static @NonNull InputResult generateInput(@NonNull Collection<String> testNumbers, @NonNull Collection<String> storedNumbers) { Set<String> allNumbers = new HashSet<>(testNumbers); Map<String, String> fuzzies = new HashMap<>(); for (String number : testNumbers) { if (mx(number)) { String add1 = mxAdd1(number); String strip1 = mxStrip1(number); if (mxMissing1(number) && !storedNumbers.contains(add1) && allNumbers.add(add1)) { fuzzies.put(number, add1); } else if (mxHas1(number) && !storedNumbers.contains(strip1) && allNumbers.add(strip1)) { fuzzies.put(number, strip1); } } } return new InputResult(allNumbers, fuzzies); }    }