void () { Registry.getInstance().reset(); String key = "first.key1"; String firstVal = "first.value1"; String secondValue = "second.value1"; final AtomicReference<Pair<String, String>> lastChangedPair = new AtomicReference<>(); Registry.setValueChangeListener(new RegistryValueListener() { @Override public void afterValueChanged(@NotNull RegistryValue value) { if (!value.getKey().equals(key)) return; lastChangedPair.set(Pair.create(value.getKey(), value.asString())); } }); Map<String, String> firstMap = new LinkedHashMap<>(); firstMap.put(key, firstVal); Registry.loadState(registryElementFromMap(firstMap), null); assertEquals(firstVal, Registry.get(key).asString()); assertNull(lastChangedPair.get()); Map<String, String> secondMap = new LinkedHashMap<>(); secondMap.put(key, secondValue); Registry.loadState(registryElementFromMap(secondMap), null); assertEquals(secondValue, Registry.get(key).asString()); assertEquals(Pair.create(key, secondValue), lastChangedPair.get()); }