Skip to content

Commit

Permalink
Fix JavaDoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
croesch committed Feb 8, 2019
1 parent c3f3750 commit e81043b
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 46 deletions.
4 changes: 4 additions & 0 deletions assertj-swing/src/main/java/org/assertj/swing/core/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ public interface Robot {
*
* @param c the {@code Component} to click on.
* @param where the given coordinates, relative to the given {@code Component}.
* @param runnable the {@link Runnable} to run while the mouse is pressed
* @see #pressMouse(Component, Point)
*/
void pressMouseWhileRunning(@Nonnull Component c, @Nonnull Point where, @Nonnull Runnable runnable);
Expand All @@ -261,6 +262,7 @@ public interface Robot {
* @param c the {@code Component} to click on.
* @param where the given coordinates, relative to the given {@code Component}.
* @param button the mouse button to press.
* @param runnable the {@link Runnable} to run while the mouse is pressed
* @see #pressMouse(Component, Point, MouseButton)
*/
void pressMouseWhileRunning(@Nonnull Component c, @Nonnull Point where, @Nonnull MouseButton button,
Expand All @@ -281,6 +283,7 @@ void pressMouseWhileRunning(@Nonnull Component c, @Nonnull Point where, @Nonnull
*
* @param where the position where to press the given mouse button.
* @param button the mouse button to press.
* @param runnable the {@link Runnable} to run while the mouse is pressed
* @see #pressMouse(Point, MouseButton)
*/
void pressMouseWhileRunning(@Nonnull Point where, @Nonnull MouseButton button, @Nonnull Runnable runnable);
Expand Down Expand Up @@ -430,6 +433,7 @@ void pressMouseWhileRunning(@Nonnull Component c, @Nonnull Point where, @Nonnull
* affect the current focus.
*
* @param keyCode the code of the key to press.
* @param runnable the {@link Runnable} to run while the key is pressed
* @see java.awt.event.KeyEvent
* @see #pressKey(int)
* @throws IllegalArgumentException if the given code is not a valid key code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ public void click(@Nonnull Component c, @Nonnull Point where) {
robot.click(c, where);
}

@Nonnull protected Settings settings() {
@Nonnull
protected Settings settings() {
return robot.settings();
}

Expand Down Expand Up @@ -229,7 +230,8 @@ public void requireNotVisible(@Nonnull Component c) {
}

@RunsInEDT
@Nonnull private static Description visibleProperty(@Nonnull Component c) {
@Nonnull
private static Description visibleProperty(@Nonnull Component c) {
return propertyName(c, VISIBLE_PROPERTY);
}

Expand All @@ -244,10 +246,12 @@ public void requireFocused(@Nonnull Component c) {
assertThat(hasFocus(c)).as(requiredFocusedErrorMessage(c)).isTrue();
}

@Nonnull private static Description requiredFocusedErrorMessage(final Component c) {
@Nonnull
private static Description requiredFocusedErrorMessage(final Component c) {
return new GuiLazyLoadingDescription() {
@Override
@Nonnull protected String loadDescription() {
@Nonnull
protected String loadDescription() {
return String.format("Expected component %s to have input focus", format(c));
}
};
Expand Down Expand Up @@ -288,7 +292,8 @@ public void requireDisabled(@Nonnull Component c) {
}

@RunsInEDT
@Nonnull private static Description enabledProperty(@Nonnull Component c) {
@Nonnull
private static Description enabledProperty(@Nonnull Component c) {
return propertyName(c, ENABLED_PROPERTY);
}

Expand Down Expand Up @@ -372,6 +377,7 @@ public void pressKey(@Nonnull Component c, int keyCode) {
*
* @param c the target {@code Component}.
* @param keyCode the code of the key to press.
* @param runnable the {@link Runnable} to run while the key is pressed
* @throws IllegalArgumentException if the given code is not a valid key code.
* @throws IllegalStateException if the {@code Component} is disabled.
* @throws IllegalStateException if the {@code Component} is not showing on the screen.
Expand Down Expand Up @@ -548,7 +554,8 @@ protected final boolean waitForShowing(@Nonnull Component c, long timeout) {
* @throws org.assertj.swing.exception.ComponentLookupException if a pop-up menu cannot be found.
*/
@RunsInEDT
@Nonnull public JPopupMenu invokePopupMenu(@Nonnull Component c) {
@Nonnull
public JPopupMenu invokePopupMenu(@Nonnull Component c) {
checkClickAllowed(c);
return robot.showPopupMenu(c);
}
Expand All @@ -567,7 +574,8 @@ protected final boolean waitForShowing(@Nonnull Component c, long timeout) {
* @throws org.assertj.swing.exception.ComponentLookupException if a pop-up menu cannot be found.
*/
@RunsInEDT
@Nonnull public JPopupMenu invokePopupMenu(@Nonnull Component c, @Nonnull Point p) {
@Nonnull
public JPopupMenu invokePopupMenu(@Nonnull Component c, @Nonnull Point p) {
checkNotNull(p);
checkClickAllowed(c);
return robot.showPopupMenu(c, p);
Expand Down Expand Up @@ -624,10 +632,12 @@ protected void checkClickAllowed(final @Nonnull Component c) {
* @see org.assertj.swing.format.Formatting#format(Component)
*/
@RunsInEDT
@Nonnull public static Description propertyName(final @Nonnull Component c, final @Nonnull String propertyName) {
@Nonnull
public static Description propertyName(final @Nonnull Component c, final @Nonnull String propertyName) {
return new GuiLazyLoadingDescription() {
@Override
@Nonnull protected String loadDescription() {
@Nonnull
protected String loadDescription() {
return String.format("%s - property:'%s'", format(c), propertyName);
}
};
Expand Down Expand Up @@ -670,7 +680,8 @@ protected final void moveMouseIgnoringAnyError(@Nonnull Component c, int x, int
* @return the font of the given {@code Component}.
*/
@RunsInEDT
@Nonnull public Font fontOf(final @Nonnull Component c) {
@Nonnull
public Font fontOf(final @Nonnull Component c) {
Font result = execute(() -> c.getFont());
return checkNotNull(result);
}
Expand All @@ -682,7 +693,8 @@ protected final void moveMouseIgnoringAnyError(@Nonnull Component c, int x, int
* @return the background color of the given {@code Component}.
*/
@RunsInEDT
@Nonnull public Color backgroundOf(final @Nonnull Component c) {
@Nonnull
public Color backgroundOf(final @Nonnull Component c) {
Color result = execute(() -> c.getBackground());
return checkNotNull(result);
}
Expand All @@ -694,7 +706,8 @@ protected final void moveMouseIgnoringAnyError(@Nonnull Component c, int x, int
* @return the foreground color of the given {@code Component}.
*/
@RunsInEDT
@Nonnull public Color foregroundOf(final @Nonnull Component c) {
@Nonnull
public Color foregroundOf(final @Nonnull Component c) {
Color result = execute(() -> c.getForeground());
return checkNotNull(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public AbstractComponentFixture(@Nonnull Class<S> selfType, @Nonnull Robot robot
this(selfType, robot, findTarget(robot, type));
}

@Nonnull private static <C extends Component> C findTarget(@Nonnull Robot robot, @Nonnull Class<? extends C> type) {
@Nonnull
private static <C extends Component> C findTarget(@Nonnull Robot robot, @Nonnull Class<? extends C> type) {
checkNotNull(robot);
checkNotNull(type);
return robot.finder().findByType(type, requireShowing(robot));
Expand All @@ -101,8 +102,9 @@ public AbstractComponentFixture(@Nonnull Class<S> selfType, @Nonnull Robot robot
this(selfType, robot, findTarget(robot, name, type));
}

@Nonnull private static <C extends Component> C findTarget(@Nonnull Robot robot, @Nullable String name,
@Nonnull Class<? extends C> type) {
@Nonnull
private static <C extends Component> C findTarget(@Nonnull Robot robot, @Nullable String name,
@Nonnull Class<? extends C> type) {
checkNotNull(robot);
checkNotNull(type);
return robot.finder().findByName(name, type, requireShowing(robot));
Expand Down Expand Up @@ -159,7 +161,8 @@ public final void replaceDriverWith(@Nonnull D driver) {
* Simulates a user clicking this fixture's {@code Component}.
*
* @return this fixture.
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is
* <code>false</code> and this
* fixture's {@code Component} is disabled.
* @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen.
*/
Expand All @@ -175,7 +178,8 @@ public final void replaceDriverWith(@Nonnull D driver) {
* @param button the button to click.
* @return this fixture.
* @throws NullPointerException if the given {@code MouseButton} is {@code null}.
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is
* <code>false</code> and this
* fixture's {@code Component} is disabled.
* @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen.
*/
Expand All @@ -191,7 +195,8 @@ public final void replaceDriverWith(@Nonnull D driver) {
* @param mouseClickInfo specifies the button to click and the times the button should be clicked.
* @return this fixture.
* @throws NullPointerException if the given {@code MouseClickInfo} is {@code null}.
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is
* <code>false</code> and this
* fixture's {@code Component} is disabled.
* @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen.
*/
Expand All @@ -205,7 +210,8 @@ public final void replaceDriverWith(@Nonnull D driver) {
* Simulates a user double-clicking this fixture's {@code Component}.
*
* @return this fixture.
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is
* <code>false</code> and this
* fixture's {@code Component} is disabled.
* @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen.
*/
Expand All @@ -232,7 +238,8 @@ public final void replaceDriverWith(@Nonnull D driver) {
* Simulates a user right-clicking this fixture's {@code Component}.
*
* @return this fixture.
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is
* <code>false</code> and this
* fixture's {@code Component} is disabled.
* @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen.
*/
Expand Down Expand Up @@ -308,6 +315,7 @@ public final void replaceDriverWith(@Nonnull D driver) {
* releasing the key again.
*
* @param keyCode the code of the key to press.
* @param runnable the {@link Runnable} to run while the key is pressed
* @return this fixture.
* @throws IllegalArgumentException if any of the given code is not a valid key code.
* @throws IllegalStateException if this fixture's {@code Component} is disabled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public AbstractSwingContainerFixture(@Nonnull Class<S> selfType, @Nonnull Robot
* Shows a pop-up menu using this fixture's {@code JScrollPane} as the invoker of the pop-up menu.
*
* @return a fixture that manages the displayed pop-up menu.
* @throws IllegalStateException if {@link Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this
* fixture's {@code JScrollPane} is disabled.
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is
* <code>false</code> and this fixture's {@code JScrollPane} is disabled.
* @throws IllegalStateException if this fixture's {@code JScrollPane} is not showing on the screen.
* @throws org.assertj.swing.exception.ComponentLookupException if a pop-up menu cannot be found.
*/
Expand All @@ -142,8 +142,8 @@ public AbstractSwingContainerFixture(@Nonnull Class<S> selfType, @Nonnull Robot
*
* @param p the given point where to show the pop-up menu.
* @return a fixture that manages the displayed pop-up menu.
* @throws IllegalStateException if {@link Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this
* fixture's {@code JScrollPane} is disabled.
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is
* <code>false</code> and this fixture's {@code JScrollPane} is disabled.
* @throws IllegalStateException if this fixture's {@code JScrollPane} is not showing on the screen.
* @throws org.assertj.swing.exception.ComponentLookupException if a pop-up menu cannot be found.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ public AbstractWindowFixture(@Nonnull Class<S> selfType, @Nonnull Robot robot, @
* Shows a pop-up menu using this fixture's {@code Window} as the invoker of the pop-up menu.
*
* @return a fixture that manages the displayed pop-up menu.
* @throws IllegalStateException if {@link Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this
* fixture's {@code Window} is disabled.
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is
* <code>false</code> and this fixture's {@code Window} is disabled.
* @throws IllegalStateException if this fixture's {@code Window} is not showing on the screen.
* @throws org.assertj.swing.exception.ComponentLookupException if a pop-up menu cannot be found.
*/
Expand All @@ -261,8 +261,8 @@ public AbstractWindowFixture(@Nonnull Class<S> selfType, @Nonnull Robot robot, @
*
* @param p the given point where to show the pop-up menu.
* @return a fixture that manages the displayed pop-up menu.
* @throws IllegalStateException if {@link Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this
* fixture's {@code Window} is disabled.
* @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is
* <code>false</code> and this fixture's {@code Window} is disabled.
* @throws IllegalStateException if this fixture's {@code Window} is not showing on the screen.
* @throws org.assertj.swing.exception.ComponentLookupException if a pop-up menu cannot be found.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public interface FrameLikeFixture<S> extends WindowLikeContainerFixture<S> {
* Verifies that the title of the given frame is equal to the expected one.
*
* @param expected the expected title.
* @return this fixture.
* @throws AssertionError if the title of the given frame is not equal to the expected one.
*/
S requireTitle(String expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public interface ItemFixture<S> extends MouseInputSimulationFixture<S> {
* @return this fixture.
* @throws IllegalStateException if the component containing this fixture's item is disabled.
* @throws IllegalStateException if the component containing this fixture's item is not showing on the screen.
* @throws ActionFailedException if there is no drag action in effect.
* @throws org.assertj.swing.exception.ActionFailedException if there is no drag action in effect.
*/
@Nonnull
S drop();
Expand All @@ -69,7 +69,7 @@ public interface ItemFixture<S> extends MouseInputSimulationFixture<S> {
* @return a fixture that handles functional testing of the displayed pop-up menu.
* @throws IllegalStateException if the component containing this fixture's item is disabled.
* @throws IllegalStateException if the component containing this fixture's item is not showing on the screen.
* @throws ComponentLookupException if a pop-up menu cannot be found.
* @throws org.assertj.swing.exception.ComponentLookupException if a pop-up menu cannot be found.
*/
@Nonnull
JPopupMenuFixture showPopupMenu();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public JButtonFixture(@Nonnull Robot robot, @Nonnull JButton target) {
* @param robot performs simulation of user events on a {@code JButton}.
* @param buttonName the name of the {@code JButton} to find using the given {@code RobotFixture}.
* @throws NullPointerException if {@code robot} is {@code null}.
* @throws ComponentLookupException if a matching {@code JButton} could not be found.
* @throws ComponentLookupException if more than one matching {@code JButton} is found.
* @throws org.assertj.swing.exception.ComponentLookupException if a matching {@code JButton} could not be found.
* @throws org.assertj.swing.exception.ComponentLookupException if more than one matching {@code JButton} is found.
*/
public JButtonFixture(@Nonnull Robot robot, @Nullable String buttonName) {
super(JButtonFixture.class, robot, buttonName, JButton.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public JCheckBoxFixture(@Nonnull Robot robot, @Nonnull JCheckBox target) {
* @param robot performs simulation of user events on a {@code JCheckBox}.
* @param checkBoxName the name of the {@code JCheckBox} to find using the given {@code Robot}.
* @throws NullPointerException if {@code robot} is {@code null}.
* @throws ComponentLookupException if a matching {@code JCheckBox} could not be found.
* @throws ComponentLookupException if more than one matching {@code JCheckBox} is found.
* @throws org.assertj.swing.exception.ComponentLookupException if a matching {@code JCheckBox} could not be found.
* @throws org.assertj.swing.exception.ComponentLookupException if more than one matching {@code JCheckBox} is found.
*/
public JCheckBoxFixture(@Nonnull Robot robot, @Nonnull String checkBoxName) {
super(JCheckBoxFixture.class, robot, checkBoxName, JCheckBox.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public JListItemFixture(@Nonnull JListFixture list, int index) {
* @throws IllegalStateException if this fixture's {@code JList} is not showing on the screen.
* @throws IndexOutOfBoundsException if this item's index is negative or greater than the index of the last item in
* the {@code JList}.
* @throws ComponentLookupException if a pop-up menu cannot be found.
* @throws org.assertj.swing.exception.ComponentLookupException if a pop-up menu cannot be found.
*/
@Override
public final @Nonnull JPopupMenuFixture showPopupMenu() {
Expand All @@ -171,7 +171,8 @@ public JListItemFixture(@Nonnull JListFixture list, int index) {

/**
* Returns the {@code String} representation of the value of this fixture's list item, using the
* {@link JListCellReader} from the {@link JListFixture} that created this {@link JListItemFixture}.
* {@link org.assertj.swing.cell.JListCellReader} from the {@link JListFixture} that created this
* {@link JListItemFixture}.
*
* @return the {@code String} representation of the value of this fixture's list item.
* @throws IndexOutOfBoundsException if this item's index is negative or greater than the index of the last item in
Expand Down Expand Up @@ -206,7 +207,7 @@ public JListItemFixture(@Nonnull JListFixture list, int index) {
* @throws IllegalStateException if this fixture's {@code JList} is not showing on the screen.
* @throws IndexOutOfBoundsException if this item's index is negative or greater than the index of the last item in
* the {@code JList}.
* @throws ActionFailedException if there is no drag action in effect.
* @throws org.assertj.swing.exception.ActionFailedException if there is no drag action in effect.
*/
@Override
public final @Nonnull JListItemFixture drop() {
Expand Down
Loading

0 comments on commit e81043b

Please sign in to comment.