### Question:
PreferenceSetterOnValidState implements ChangeListener<ValidationState> { @Override public void changed(ObservableValue<? extends ValidationState> observable, ValidationState oldValue, ValidationState newValue) { if (newValue == ValidationState.VALID) { userContext.setStringPreference(preference, textField.getText()); LOG.trace("Preference {} set to {}", preference, textField.getText()); } } PreferenceSetterOnValidState(StringUserPreference preference, ValidableTextField textField, UserContext userContext); @Override void changed(ObservableValue<? extends ValidationState> observable, ValidationState oldValue,
            ValidationState newValue);  }### Answer:
@Test public void changed() { PreferenceSetterOnValidState victim = new PreferenceSetterOnValidState(StringUserPreference.STARTUP_MODULE, new ValidableTextField("testText"), userContext); victim.changed(null, ValidationState.NOT_VALIDATED, ValidationState.VALID); verify(userContext).setStringPreference(StringUserPreference.STARTUP_MODULE, "testText"); }