info.novatec.testit.webtester.conditions.syntax.Not 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 negated result of another condition. This
* is intended to be used to check for a condition to not be met.
*
* Example: Waits.waitUntil(checkbox, is(not(selected())));
*
* @param type of the object to test against the condition
* @see Condition
* @since 2.0
*/
@AllArgsConstructor
public class Not implements Condition {
@NonNull
private final Condition condition;
@Override
public boolean test(T value) {
return !condition.test(value);
}
@Override
public String toString() {
return "not(" + condition + ')';
}
}