net.jqwik.testing.TestingFalsifier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jqwik-testing Show documentation
Show all versions of jqwik-testing Show documentation
Jqwik Testing support module
The newest version!
package net.jqwik.testing;
import java.util.function.*;
import org.apiguardian.api.*;
import org.jspecify.annotations.*;
import org.opentest4j.*;
import net.jqwik.api.*;
import net.jqwik.api.lifecycle.*;
import static org.apiguardian.api.API.Status.*;
@API(status = EXPERIMENTAL, since = "1.4.0")
public interface TestingFalsifier extends Falsifier, Predicate {
static TestingFalsifier alwaysFalsify() {
return ignore -> false;
}
static TestingFalsifier falsifier(Predicate super T> predicate) {
return predicate::test;
}
@Override
default TryExecutionResult execute(T parameters) {
try {
boolean result = this.test(parameters);
return result ? TryExecutionResult.satisfied() : TryExecutionResult.falsified(null);
} catch (TestAbortedException tea) {
return TryExecutionResult.invalid();
} catch (AssertionError | Exception e) {
return TryExecutionResult.falsified(e);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy