0

I want to test my simple application with AssertJ. I can check that text is showing like that:

frame.label(JLabelMatcher.withText(text).andShowing());

But is there any way to check that specific text not showing?

Dmitriy
  • 487
  • 5
  • 15

1 Answers1

0

As a result, I solved this issue in such a not pretty way:

public void iDontSeeText(String text) {
    try {
        frame.label(JLabelMatcher.withText(Pattern.compile(".*" + text + ".*", Pattern.CASE_INSENSITIVE)).andShowing());
    } catch (Exception e) {
        // Control isn't found. Test complete successful
        return;
    }
    // Control is found. Execute exception
    throw new RuntimeException("Text \"" + text + "\" is found in frame.");
}
Dmitriy
  • 487
  • 5
  • 15