@Test public void generateOutputV2_no1Match_1ToNo1() { OutputResultV2 result = FuzzyPhoneNumberHelper.generateOutputV2(mapOf(MX_A, UUID_A), new InputResult(setOf(MX_A, MX_A_1), Collections.singletonMap(MX_A_1, MX_A))); assertEquals(1, result.getNumbers().size()); assertEquals(UUID_A, result.getNumbers().get(MX_A)); assertEquals(MX_A, result.getRewrites().get(MX_A_1)); }
static @NonNull OutputResultV2 generateOutputV2(@NonNull Map<String, UUID> registeredNumbers, @NonNull InputResult inputResult) { Map<String, UUID> allNumbers = new HashMap<>(registeredNumbers); Map<String, String> rewrites = new HashMap<>(); for (Map.Entry<String, String> entry : inputResult.getFuzzies().entrySet()) { if (registeredNumbers.containsKey(entry.getKey()) && registeredNumbers.containsKey(entry.getValue())) { if (mxHas1(entry.getKey())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } else { allNumbers.remove(entry.getValue()); } } else if (registeredNumbers.containsKey(entry.getValue())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } } return new OutputResultV2(allNumbers, rewrites); }
FuzzyPhoneNumberHelper { static @NonNull OutputResultV2 generateOutputV2(@NonNull Map<String, UUID> registeredNumbers, @NonNull InputResult inputResult) { Map<String, UUID> allNumbers = new HashMap<>(registeredNumbers); Map<String, String> rewrites = new HashMap<>(); for (Map.Entry<String, String> entry : inputResult.getFuzzies().entrySet()) { if (registeredNumbers.containsKey(entry.getKey()) && registeredNumbers.containsKey(entry.getValue())) { if (mxHas1(entry.getKey())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } else { allNumbers.remove(entry.getValue()); } } else if (registeredNumbers.containsKey(entry.getValue())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } } return new OutputResultV2(allNumbers, rewrites); } }
FuzzyPhoneNumberHelper { static @NonNull OutputResultV2 generateOutputV2(@NonNull Map<String, UUID> registeredNumbers, @NonNull InputResult inputResult) { Map<String, UUID> allNumbers = new HashMap<>(registeredNumbers); Map<String, String> rewrites = new HashMap<>(); for (Map.Entry<String, String> entry : inputResult.getFuzzies().entrySet()) { if (registeredNumbers.containsKey(entry.getKey()) && registeredNumbers.containsKey(entry.getValue())) { if (mxHas1(entry.getKey())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } else { allNumbers.remove(entry.getValue()); } } else if (registeredNumbers.containsKey(entry.getValue())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } } return new OutputResultV2(allNumbers, rewrites); }  }
FuzzyPhoneNumberHelper { static @NonNull OutputResultV2 generateOutputV2(@NonNull Map<String, UUID> registeredNumbers, @NonNull InputResult inputResult) { Map<String, UUID> allNumbers = new HashMap<>(registeredNumbers); Map<String, String> rewrites = new HashMap<>(); for (Map.Entry<String, String> entry : inputResult.getFuzzies().entrySet()) { if (registeredNumbers.containsKey(entry.getKey()) && registeredNumbers.containsKey(entry.getValue())) { if (mxHas1(entry.getKey())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } else { allNumbers.remove(entry.getValue()); } } else if (registeredNumbers.containsKey(entry.getValue())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } } return new OutputResultV2(allNumbers, rewrites); }   }
FuzzyPhoneNumberHelper { static @NonNull OutputResultV2 generateOutputV2(@NonNull Map<String, UUID> registeredNumbers, @NonNull InputResult inputResult) { Map<String, UUID> allNumbers = new HashMap<>(registeredNumbers); Map<String, String> rewrites = new HashMap<>(); for (Map.Entry<String, String> entry : inputResult.getFuzzies().entrySet()) { if (registeredNumbers.containsKey(entry.getKey()) && registeredNumbers.containsKey(entry.getValue())) { if (mxHas1(entry.getKey())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } else { allNumbers.remove(entry.getValue()); } } else if (registeredNumbers.containsKey(entry.getValue())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } } return new OutputResultV2(allNumbers, rewrites); }    }