void () { Registry.getInstance().reset(); String key = "first.key2"; String firstVal = "first.value2"; String eaKey = "ea.first.key"; String eaFirstVal = "ea.first.value"; String eaSecondValue = "ea.second.value"; final AtomicReference<Pair<String, String>> lastChangedPair = new AtomicReference<>(); Registry.setValueChangeListener(new RegistryValueListener() { @Override public void afterValueChanged(@NotNull RegistryValue value) { if (!(value.getKey().equals(key) || value.getKey().equals(eaKey))) return; lastChangedPair.set(Pair.create(value.getKey(), value.asString())); } }); Registry.loadState(registryElementFromMap(Map.of(key, firstVal)), Map.of(eaKey, eaFirstVal)); assertEquals(firstVal, Registry.get(key).asString()); assertEquals(eaFirstVal, Registry.get(eaKey).asString()); assertNull(lastChangedPair.get()); Registry.loadState(registryElementFromMap(Map.of(key, firstVal, eaKey, eaSecondValue)), null); assertEquals(firstVal, Registry.get(key).asString()); assertEquals(eaSecondValue, Registry.get(eaKey).asString()); assertEquals(Pair.create(eaKey, eaSecondValue), lastChangedPair.get()); }