### Question:
MergeValidator implements ChangeListener<String> { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { String errorMessage = null; if (StringUtils.isNotEmpty(newValue)) { DataGroupInfo groupInfo = myGroupController.getDataGroupInfo(newValue); if (groupInfo != null) { errorMessage = "Layer name already exists."; } } else { errorMessage = "Please type in a new layer name."; } if (errorMessage == null) { myValidatorSupport.setValidationResult(ValidationStatus.VALID, null); } else { myValidatorSupport.setValidationResult(ValidationStatus.ERROR, errorMessage); } } MergeValidator(DataGroupController groupController, MergeModel model); @Override void changed(ObservableValue<? extends String> observable, String oldValue, String newValue); ValidatorSupport getValidatorSupport();  }### Answer:
@Test public void testChanged() { EasyMockSupport support = new EasyMockSupport(); DataGroupController groupController = createGroupController(support, null); support.replayAll(); MergeModel model = new MergeModel(New.list()); MergeValidator validator = new MergeValidator(groupController, model); assertEquals(ValidationStatus.ERROR, validator.getValidatorSupport().getValidationStatus()); assertEquals("Please type in a new layer name.", validator.getValidatorSupport().getValidationMessage()); model.getNewLayerName().set(ourLayerName); assertEquals(ValidationStatus.VALID, validator.getValidatorSupport().getValidationStatus()); assertNull(validator.getValidatorSupport().getValidationMessage()); support.verifyAll(); }