textField.setValue("TEST");
assertEquals(new Integer(0), textField.getValue());
}
public void testDefaultEditor_propertyChange() throws Exception {
DefaultEditor defaultEditor = (DefaultEditor) spinner.getEditor();
PropertyChangeController pcc = new PropertyChangeController();
ChangeController modelController = new ChangeController();
defaultEditor.getTextField().addPropertyChangeListener(pcc);
spinner.getModel().addChangeListener(modelController);
defaultEditor.getTextField().setText("15");
defaultEditor.commitEdit();
assertTrue(pcc.isChanged());
assertTrue(modelController.isChanged());
modelController.reset();
defaultEditor.getTextField().removePropertyChangeListener(defaultEditor);
defaultEditor.getTextField().setText("18");
defaultEditor.commitEdit();
defaultEditor.getTextField().addPropertyChangeListener(defaultEditor);
defaultEditor.propertyChange(new PropertyChangeEvent(defaultEditor.getTextField(),
"value", defaultEditor.getTextField().getValue(), new Integer(10)));
assertTrue(modelController.isChanged());
modelController.reset();
defaultEditor.getTextField().removePropertyChangeListener(defaultEditor);
defaultEditor.getTextField().setText("58");
defaultEditor.commitEdit();
defaultEditor.getTextField().addPropertyChangeListener(defaultEditor);
defaultEditor.propertyChange(new PropertyChangeEvent(new Integer(10), "value",
new Integer(13), new Integer(10)));
assertFalse(modelController.isChanged());
}