Search in sources :

Example 1 with StringEventData

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);
}
Also used : ComponentFinder(junit.extensions.jfcunit.finder.ComponentFinder) StringEventData(junit.extensions.jfcunit.eventdata.StringEventData) AbstractButtonFinder(junit.extensions.jfcunit.finder.AbstractButtonFinder) JButton(javax.swing.JButton) MouseEventData(junit.extensions.jfcunit.eventdata.MouseEventData) JTextField(javax.swing.JTextField) DialogFinder(junit.extensions.jfcunit.finder.DialogFinder) JDialog(javax.swing.JDialog)

Aggregations

JButton (javax.swing.JButton)1 JDialog (javax.swing.JDialog)1 JTextField (javax.swing.JTextField)1 MouseEventData (junit.extensions.jfcunit.eventdata.MouseEventData)1 StringEventData (junit.extensions.jfcunit.eventdata.StringEventData)1 AbstractButtonFinder (junit.extensions.jfcunit.finder.AbstractButtonFinder)1 ComponentFinder (junit.extensions.jfcunit.finder.ComponentFinder)1 DialogFinder (junit.extensions.jfcunit.finder.DialogFinder)1