public final class DialogMatcher extends NamedComponentMatcherTemplate<Dialog>
Dialog
s by name, title or visibility on the screen.Modifier and Type | Method and Description |
---|---|
DialogMatcher |
andShowing()
Indicates that the AWT or Swing
Dialog to match should be showing on the screen. |
DialogMatcher |
andTitle(Pattern titlePattern)
Specifies the title to match.
|
DialogMatcher |
andTitle(String newTitle)
Specifies the title to match.
|
static DialogMatcher |
any()
Creates a new
DialogMatcher that matches any Dialog . |
protected boolean |
isMatching(Dialog dialog)
Indicates whether the name and title of the given AWT or Swing
Dialog match the ones in this matcher. |
String |
toString() |
static DialogMatcher |
withName(String name)
Creates a new
DialogMatcher that matches an AWT or Swing Dialog by name. |
static DialogMatcher |
withTitle(Pattern pattern)
Creates a new
DialogMatcher that matches an AWT or Swing Dialog by title. |
static DialogMatcher |
withTitle(String title)
Creates a new
DialogMatcher that matches an AWT or Swing Dialog by title. |
anyValue, arePropertyValuesMatching, isNameMatching, name, quoted, quotedName
matches, supportedType
requireShowing, requireShowing, requireShowingMatches, reset
public static DialogMatcher withName(@Nullable String name)
Creates a new DialogMatcher
that matches an AWT or Swing Dialog
by name.
The following code listing shows how to match a Dialog
by name and title:
DialogMatcher m =withName
("saveFile").andTitle
("Save File");
The following code listing shows how to match a Dialog
, that should be showing on the screen, by name and
title:
DialogMatcher m =withName
("saveFile").andTitle
("Save File").andShowing
();
name
- the id to match.@Nonnull public static DialogMatcher withTitle(@Nullable String title)
Creates a new DialogMatcher
that matches an AWT or Swing Dialog
by title.
The following code listing shows how to match a Dialog
title:
DialogMatcher m = withTitle
("Save File");
The following code listing shows how to match a Dialog
, that should be showing on the screen, by title:
DialogMatcher m =withTitle
("Save File").andShowing
();
title
- the title to match. It can be a regular expression.@Nonnull public static DialogMatcher withTitle(@Nonnull Pattern pattern)
Creates a new DialogMatcher
that matches an AWT or Swing Dialog
by title.
The following code listing shows how to match a Dialog
title, using a regular expression pattern:
DialogMatcher m = withTitle
(Pattern.compile("Sav.*"));
The following code listing shows how to match a Dialog
, that should be showing on the screen, by title,
using a regular expression pattern:
DialogMatcher m =withTitle
(Pattern.compile("Sav.*")).andShowing
();
pattern
- the regular expression pattern to match.@Nonnull public static DialogMatcher any()
DialogMatcher
that matches any Dialog
.@Nonnull public DialogMatcher andTitle(@Nullable String newTitle)
withTitle(String)
or
withTitle(Pattern)
, this method will simply update the title to match.newTitle
- the new title to match. It can be a regular expression.public DialogMatcher andTitle(@Nonnull Pattern titlePattern)
withTitle(String)
, or
withTitle(Pattern)
this method will simply update the title to match.titlePattern
- the regular expression pattern to match.@Nonnull public DialogMatcher andShowing()
Dialog
to match should be showing on the screen.@RunsInCurrentThread protected boolean isMatching(@Nonnull Dialog dialog)
Indicates whether the name and title of the given AWT or Swing Dialog
match the ones in this matcher.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT). Client code must call this method from the EDT.
isMatching
in class GenericTypeMatcher<Dialog>
dialog
- the Dialog
to match.true
if the Dialog
matches the search criteria in this matcher.Copyright © 2014–2019 AssertJ. All rights reserved.