/** * Finds and returns the {@code JList} in the pop-up raised by this fixture's {@code JComboBox}. * * @return the {@code JList} in the pop-up raised by this fixture's {@code JComboBox}. * @throws org.assertj.swing.exception.ComponentLookupException if the {@code JList} in the pop-up could not be found. */ @Nonnull public JList list() { return driver().dropDownList(); }
public void replaceCellReader(@Nonnull JComboBoxCellReader cellReader) { driver().replaceCellReader(cellReader); } }
/** * @return the {@code String} representation of the elements in this fixture's {@code JComboBox}, using this fixture's * {@link JComboBoxCellReader}. * @see #replaceCellReader(JComboBoxCellReader) */ @Override @Nonnull public String[] contents() { return driver().contentsOf(target()); }
/** * Verifies that the index of the selected item in this fixture's {@code JComboBox} is equal to the given value. * * @param index the expected selection index. * @return this fixture. * @throws AssertionError if the selected index is not equal to the given one. */ @Override @Nonnull public JComboBoxFixture requireSelection(int index) { driver().requireSelection(target(), index); return this; }
/** * Verifies that this fixture's {@code JComboBox} does not have any selection. * * @return this fixture. * @throws AssertionError if this fixture's {@code JComboBox} has a selection. */ @Override @Nonnull public JComboBoxFixture requireNoSelection() { driver().requireNoSelection(target()); return this; }
/** * Returns the selected value of this fixture's {@code JComboBox} as plain text. This method returns {@code null} if * the {code JComboBox} does not have any selection. * * @return the selected value of this fixture's {code JComboBox} as plain text, or {@code null} if the {code * JComboBox} does not have any selection. */ @Nullable public String selectedItem() { return driver().selectedItemOf(target()); }
/** * Clears the selection in this fixture's {@code JComboBox}. Since this method does not simulate user input, it does * not verifies that this fixture's {@code JComboBox} is enabled and showing. * * @return this fixture. */ @Override @Nonnull public JComboBoxFixture clearSelection() { driver().clearSelection(target()); return this; }
/** * Simulates a user entering the specified text in the {@code JComboBox}, replacing any text. This action is executed * only if the {@code JComboBox} is editable. * * @param text the text to enter. * @return this fixture. * @throws IllegalStateException if this fixture's {@code JComboBox} is disabled. * @throws IllegalStateException if this fixture's {@code JComboBox} is not showing on the screen. * @throws IllegalStateException if this fixture's {@code JComboBox} is not editable. */ @Nonnull public JComboBoxFixture replaceText(@Nonnull String text) { driver().replaceText(target(), text); return this; }
/** * Verifies that the {@code String} representation of the selected item in this fixture's {@code JComboBox} matches * the given text. * * @param value the text to match. It can be a regular expression. * @return this fixture. * @throws AssertionError if the selected item does not match the given text. * @see #replaceCellReader(JComboBoxCellReader) */ @Override @Nonnull public JComboBoxFixture requireSelection(@Nullable String value) { driver().requireSelection(target(), value); return this; }
/** * Verifies that this fixture's {@code JComboBox} has the expected number of items * * @param expected the expected number of items. * @return this fixture. * @throws AssertionError if the number of items in this fixture's {@code JComboBox} is not equal to the expected one. */ @Override @Nonnull public JComboBoxFixture requireItemCount(int expected) { driver().requireItemCount(target(), expected); return this; }
/** * Asserts that this fixture's {@code JComboBox} is editable. * * @throws AssertionError if this fixture's {@code JComboBox} is not editable. * @return this fixture. */ @Override @Nonnull public JComboBoxFixture requireEditable() { driver().requireEditable(target()); return this; }
/** * Asserts that this fixture's {@code JComboBox} is not editable. * * @throws AssertionError if this fixture's {@code JComboBox} is editable. * @return this fixture. */ @Override @Nonnull public JComboBoxFixture requireNotEditable() { driver().requireNotEditable(target()); return this; }
/** * Simulates a user selecting the text in the {@code JComboBox}. This action is executed only if the {@code JComboBox} * is editable. * * @return this fixture. * @throws IllegalStateException if this fixture's {@code JComboBox} is disabled. * @throws IllegalStateException if this fixture's {@code JComboBox} is not showing on the screen. * @throws IllegalStateException if this fixture's {@code JComboBox} is not editable. */ @Nonnull public JComboBoxFixture selectAllText() { driver().selectAllText(target()); return this; }
/** * Verifies that the {@code String} representation of the selected item in this fixture's {@code JComboBox} matches * the given regular expression pattern. * * @param pattern the regular expression pattern to match. * @return this fixture. * @throws NullPointerException if the given regular expression pattern is {@code null}. * @throws AssertionError if the selected item does not match the given regular expression pattern. * @see #replaceCellReader(JComboBoxCellReader) */ @Override @Nonnull public JComboBoxFixture requireSelection(@Nonnull Pattern pattern) { driver().requireSelection(target(), pattern); return this; }
/** * Simulates a user selecting an item in this fixture's {@code JComboBox}. The text of the item to select must match * the given {@code String}. Such text is retrieved by this fixture's {@link JComboBoxCellReader}. * * @param text the text of the item to select. It can be a regular expression. * @return this fixture. * @throws org.assertj.swing.exception.LocationUnavailableException if an element matching the given text cannot be found. * @throws IllegalStateException if this fixture's {@code JComboBox} is disabled. * @throws IllegalStateException if this fixture's {@code JComboBox} is not showing on the screen. * @see #replaceCellReader(JComboBoxCellReader) */ @Override @Nonnull public JComboBoxFixture selectItem(@Nullable String text) { driver().selectItem(target(), text); return this; }
/** * Simulates a user entering the specified text in this fixture's {@code JComboBox}. This action is executed only if * the {@code JComboBox} is editable. * * @param text the text to enter. * @return this fixture. * @throws IllegalStateException if this fixture's {@code JComboBox} is disabled. * @throws IllegalStateException if this fixture's {@code JComboBox} is not showing on the screen. * @throws IllegalStateException if this fixture's {@code JComboBox} is not editable. * @throws org.assertj.swing.exception.ActionFailedException if this fixture's {@code JComboBox} does not have an editor. */ @Nonnull public JComboBoxFixture enterText(@Nonnull String text) { driver().enterText(target(), text); return this; }
/** * Simulates a user selecting an item in this fixture's {@code JComboBox}. * * @param index the index of the item to select. * @return this fixture. * @throws IllegalStateException if this fixture's {@code JComboBox} is disabled. * @throws IllegalStateException if this fixture's {@code JComboBox} is not showing on the screen. * @throws IndexOutOfBoundsException if the given index is negative or greater than the index of the last item in the * {@code JComboBox}. */ @Override @Nonnull public JComboBoxFixture selectItem(int index) { driver().selectItem(target(), index); return this; }
/** * Simulates a user selecting an item in this fixture's {@code JComboBox}. The text of the item to select must match * the given regular expression pattern. Such text is retrieved by this fixture's {@link JComboBoxCellReader}. * * @param pattern the regular expression pattern to match. * @return this fixture. * @throws org.assertj.swing.exception.LocationUnavailableException if an element matching the given pattern cannot be found. * @throws IllegalStateException if this fixture's {@code JComboBox} is disabled. * @throws IllegalStateException if this fixture's {@code JComboBox} is not showing on the screen. * @throws NullPointerException if the given regular expression pattern is {@code null}. * @see #replaceCellReader(JComboBoxCellReader) */ @Override @Nonnull public JComboBoxFixture selectItem(@Nonnull Pattern pattern) { driver().selectItem(target(), pattern); return this; }
/** * Returns the {@code String} representation of the value of an item in this fixture's {@code JComboBox}, using this * fixture's {@link JComboBoxCellReader}. * * @param index the index of the item to return. * @return the {@code String} representation of the value of an item in this fixture's {@code JComboBox}. * @throws IndexOutOfBoundsException if the given index is negative or greater than the index of the last item in the * {@code JComboBox}. * @see #replaceCellReader(JComboBoxCellReader) */ @Override @Nullable public String valueAt(int index) { return driver().value(target(), index); }