use of junit.extensions.jfcunit.eventdata.StringEventData in project ACS by ACS-Community.
the class AddToDeployTreeTest method testPortValidation.
public void testPortValidation() throws Exception {
JDialog dialog;
AbstractButtonFinder buttonFinder = new AbstractButtonFinder("Add to View");
// { m_ignoreVisiblity || comp.isShowing() }
buttonFinder.setIgnoreVisibility(true);
JButton addButton = (JButton) buttonFinder.find(panel, 0);
assertNotNull("Could not find the Add button", addButton);
buttonFinder.setText("Full Refresh");
JButton refreshButton = (JButton) buttonFinder.find(panel, 0);
assertNotNull("Could not find the Refresh button", refreshButton);
ComponentFinder componentFinder = new ComponentFinder(JTextField.class);
// { m_ignoreVisiblity || comp.isShowing() }
componentFinder.setIgnoreVisibility(true);
JTextField hostField = (JTextField) componentFinder.find(panel, 0);
assertNotNull("Could not find the host field", hostField);
assertEquals("host field is empty", "", hostField.getText());
JTextField portField = (JTextField) componentFinder.find(panel, 0);
assertNotNull("Could not find the port field", portField);
assertEquals("port field is empty", "", portField.getText());
getHelper().sendString(new StringEventData(this, hostField, "testhost"));
getHelper().sendString(new StringEventData(this, portField, "2"));
getHelper().enterClickAndLeave(new MouseEventData(this, addButton));
DialogFinder dFinder = new DialogFinder(null);
dFinder.setWait(2);
List<Object> showingDialogs = dFinder.findAll();
assertEquals("Number of dialogs showing is wrong", 1, showingDialogs.size());
dialog = (JDialog) showingDialogs.get(0);
assertEquals("Wrong dialog showing up", "Message", dialog.getTitle());
TestHelper.disposeWindow(dialog, this);
}
Aggregations