void () { String registryValue = "testBoolean"; RegistryValue regValue = new RegistryValue(Registry.getInstance(), registryValue, null); regValue.setValue(false); Registry.setValueChangeListener(new RegistryValueListener() { @Override public void beforeValueChanged(@NotNull RegistryValue value) { regValue.asBoolean(); } }); regValue.setValue(true); assertTrue(regValue.asBoolean()); }