Skip to content

Matchers

rawagner edited this page Aug 28, 2013 · 3 revisions

Matchers are widely used in RedDeer to perform selection based on given criteria like comparing if given widget fits required class or if test corresponds with given regex expression. RedDeer is currently using hamcrest matchers which can be changed in the future.

Matchers are internally used but you can use them also externally and mix them and also create your own customized matchers and that can be used in many lookup constructors.

For example you can use this constructor with available machers or your own implementation

public DefaultText(Matcher... matchers){

for example if you want to find DefaultText with text that contains version in standard (major,minor,build) format inside you can perform something like this:

Matcher m = new RegexMatcher(".*\\d+\\.\\d+\\.\\d+.*")
Text t = new DefaultText(m);

You can use multiple matcher classes provided by RedDeer like

  • TextMatcher
  • RegexMatcher
  • LabelMatcher
  • etc.

and combine them if you want or create one multi matcher by using AndMatcher if you want.

Clone this wiki locally