Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: FEST-Swing 1.2a4
-
Fix Version/s: FEST-Swing 1.2rc
-
Component/s: Swing
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
Hi.
Along the lines of FEST-286, I just confused myself because the WaitTimedOutError message given when two dialogs are matched is no different than when no match is found at all.
See the example and comments here:
public static void main(String[] args) { Robot robot = BasicRobot.robotWithCurrentAwtHierarchy(); final JFrame f = new JFrame("ParentForTwo"); f.setName("ParentForTwo"); JButton b1 = new JButton("Open dialog 1"); b1.setName("b1"); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JDialog d1 = new JDialog(f, "Dialog 1"); d1.setName("Dialog 1"); JButton b2 = new JButton("Open dialog 2"); b2.setName("b2"); b2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JDialog d2 = new JDialog(f, "Dialog 2"); d2.setName("Dialog 2"); d2.getContentPane().add(new JLabel("Just a label")); d2.pack(); d2.setVisible(true); } }); d1.getContentPane().add(b2); d1.pack(); d1.setVisible(true); } }); f.getContentPane().add(b1); f.pack(); f.setVisible(true); FrameFixture ff = WindowFinder.findFrame("ParentForTwo").using(robot); ff.button().click(); ff.dialog().button().click(); DialogFixture unfindableDialog = ff.dialog("Dialog 2"); //works unfindableDialog = ff.dialog(); // fails with a not very helpful error message // Exception in thread "main" org.fest.swing.exception.WaitTimedOutError: // Timed out waiting for dialog to be found using matcher // org.fest.swing.core.TypeMatcher[type=java.awt.Dialog, requireShowing=true] unfindableDialog.requireFocused(); }
I don't quite have a suggestion on how to provide a better message, but from a user's point of view, the message should be different depending on if no components or multiple components were matched...