01: package org.uispec4j.assertion;
02:
03: /**
04: * Interface used for defining conditions. These assertions are meant to be used
05: * essentially with the {@link UISpecAssert] "assertXxx" and "waitUntil" methods.
06: */
07: public abstract class Assertion {
08:
09: /**
10: * Returns true if the {@link #check()} method does not fail.
11: */
12: public final boolean isTrue() {
13: try {
14: check();
15: return true;
16: } catch (Throwable e) {
17: return false;
18: }
19: }
20:
21: /**
22: * Throws an exception if the condition is not true.
23: */
24: public abstract void check() throws Exception;
25: }
|