text

open fun text(condition: Condition<String>): Condition<InspectableComponent>

Matcher that succeeds if a InspectableComponent has text content that matches the provided condition.

N.B. We are implicitly casting the CharSequence to a String when matching so that more powerful matchers can be applied like sub-string matching.

Example Use


mComponent = MyComponent.create(c).text("Cells interlinked within cells interlinked").build();
assertThat(c, mComponent)
  .has(subComponentWith(c, startsWith("Cells")))
  .doesNotHave(subComponentWith(c, text(containsString("A Tall White Fountain Played."))));

open fun text(matcher: Matcher<String>): Condition<InspectableComponent>

Matcher that succeeds if a InspectableComponent has text content that matches the provided hamcrest matcher.

Return

Wrapper around text