info.novatec.testit.webtester.conditions.syntax.Has Maven / Gradle / Ivy
package info.novatec.testit.webtester.conditions.syntax;
import lombok.AllArgsConstructor;
import lombok.NonNull;
import info.novatec.testit.webtester.conditions.Condition;
/**
* {@link Condition} which returns the result of another condition. This is intended to
* be used to enhance code readability.
*
* Example: Waits.waitUntil(textfield, has(text("foo")));
is
* more readable then Waits.waitUntil(textfield, text("foo"));
*
* @param type of the object to test against the condition
* @see Condition
* @since 2.0
*/
@AllArgsConstructor
public class Has implements Condition {
@NonNull
private final Condition condition;
@Override
public boolean test(T value) {
return condition.test(value);
}
@Override
public String toString() {
return "has(" + condition + ')';
}
}