/** * Creates a new {@link JOptionPaneFixture}. * * @param robot finds a showing {@code JOptionPane}, which will be managed by this fixture. * @throws NullPointerException if {@code robot} is {@code null}. * @throws org.assertj.swing.exception.ComponentLookupException if a showing {@code JOptionPane} could not be found. * @throws org.assertj.swing.exception.ComponentLookupException if more than one showing {@code JOptionPane} is found. */ public JOptionPaneFixture(@Nonnull Robot robot) { this(robot, findShowingOptionPane(robot)); }
/** * Returns a fixture wrapping the "Cancel" button in this fixture's {@code JOptionPane}. This method is * locale-independent and platform-independent. * * @return a fixture wrapping the "Cancel" button. * @throws org.assertj.swing.exception.ComponentLookupException if the a "Cancel" button cannot be found. */ @Nonnull public JButtonFixture cancelButton() { return new JButtonFixture(robot(), driver().cancelButton(target())); }
public JOptionPane errorDialog() { JOptionPaneFixture jOptionPaneFixture = fixture.optionPane(Timeout.timeout(250)); return jOptionPaneFixture.target(); } }
/** * Finds a {@code JOptionPane} by name or type. * * @param robot contains the underlying finding to delegate the search to. * @return a {@code JOptionPaneFixture} managing the found {@code JOptionPane}. * @throws org.assertj.swing.exception.WaitTimedOutError if a {@code JOptionPane} could not be found. */ @Override @Nonnull public JOptionPaneFixture using(@Nonnull Robot robot) { return new JOptionPaneFixture(robot, findComponentWith(robot)); }
@RunsInEDT @Override @Nonnull public JOptionPaneFixture optionPane(@Nonnull Timeout timeout) { TypeMatcher matcher = new TypeMatcher(JOptionPane.class, requireShowing()); String description = "option pane to be found using matcher " + matcher; ComponentFoundCondition condition = new ComponentFoundCondition(description, robot().finder(), matcher); pause(condition, timeout); JOptionPane optionPane = (JOptionPane) condition.found(); return new JOptionPaneFixture(robot(), checkNotNull(optionPane)); }
/** * Returns a fixture wrapping the "No" button in this fixture's {@code JOptionPane}. This method is locale-independent * and platform-independent. * * @return a fixture wrapping the "No" button. * @throws org.assertj.swing.exception.ComponentLookupException if the a "No" button cannot be found. */ @Nonnull public JButtonFixture noButton() { return new JButtonFixture(robot(), driver().noButton(target())); }
/** * Returns a fixture wrapping the "Yes" button in this fixture's {@code JOptionPane}. This method is * locale-independent and platform-independent. * * @return a fixture wrapping the "Yes" button. * @throws org.assertj.swing.exception.ComponentLookupException if the a "Yes" button cannot be found. */ @Nonnull public JButtonFixture yesButton() { return new JButtonFixture(robot(), driver().yesButton(target())); }
/** * Returns a fixture wrapping the "OK" button in this fixture's {@code JOptionPane}. This method is locale-independent * and platform-independent. * * @return a fixture wrapping the "OK" button. * @throws org.assertj.swing.exception.ComponentLookupException if the a "OK" button cannot be found. */ @Nonnull public JButtonFixture okButton() { return new JButtonFixture(robot(), driver().okButton(target())); }
/** * Finds and returns a fixture wrapping a button (this fixture's {@code JOptionPane}) matching the given text. * * @param pattern the regular expression pattern to match. * @return a fixture wrapping a button matching the given regular expression pattern. * @throws NullPointerException if the given regular expression pattern is {@code null}. * @throws org.assertj.swing.exception.ComponentLookupException if the a button with the given text cannot be found. */ @Nonnull public JButtonFixture buttonWithText(@Nonnull Pattern pattern) { return new JButtonFixture(robot(), driver().buttonWithText(target(), pattern)); }
/** * Finds and returns a fixture wrapping a button (this fixture's {@code JOptionPane}) matching the given text. * * @param text the text of the button to find. It can be a regular expression. * @return a fixture wrapping a button matching the given text. * @throws org.assertj.swing.exception.ComponentLookupException if the a button with the given text cannot be found. */ @Nonnull public JButtonFixture buttonWithText(@Nullable String text) { return new JButtonFixture(robot(), driver().buttonWithText(target(), text)); }
/** * Asserts that the title of this fixture's {@code JOptionPane} matches the given regular expression pattern. * * @param pattern the regular expression pattern to match. * @return this fixture. * @throws NullPointerException if the given regular expression is {@code null}. * @throws AssertionError if this fixture's {@code JOptionPaneFixture} does not have the given title. */ @Nonnull public JOptionPaneFixture requireTitle(@Nonnull Pattern pattern) { driver().requireTitle(target(), pattern); return this; }
/** * Asserts that the title of this fixture's {@code JOptionPane} matches the given value. * * @param title the title to match. It can be a regular expression. * @return this fixture. * @throws AssertionError if this fixture's {@code JOptionPaneFixture} does not have the given title. */ @Nonnull public JOptionPaneFixture requireTitle(@Nullable String title) { driver().requireTitle(target(), title); return this; }
/** * Asserts that the message of this fixture's {@code JOptionPane} matches the given value. * * @param message the message to verify. If it is a {@code String}, it can be specified as a regular expression. * @return this fixture. * @throws AssertionError if the message in this fixture's {@code JOptionPaneFixture} is not equal to or does not * match the given message. */ @Nonnull public JOptionPaneFixture requireMessage(@Nullable Object message) { driver().requireMessage(target(), message); return this; }
/** * Asserts that this fixture's {@code JOptionPane} has the given options. * * @param options the options to verify. * @return this fixture. * @throws AssertionError if this fixture's {@code JOptionPaneFixture} does not have the given options. */ @Nonnull public JOptionPaneFixture requireOptions(@Nonnull Object[] options) { driver().requireOptions(target(), options); return this; } }