com.github.dakusui.pcond.provider.AssertionProvider Maven / Gradle / Ivy
package com.github.dakusui.pcond.provider;
import com.github.dakusui.pcond.internals.InternalUtils;
import com.github.dakusui.pcond.provider.impls.DefaultAssertionProvider;
import java.util.Properties;
import java.util.function.Predicate;
public interface AssertionProvider {
AssertionProvider> INSTANCE = createAssertionProvider(System.getProperties());
static AssertionProvider> createAssertionProvider(Properties properties) {
String propertyKeyName = AssertionProvider.class.getCanonicalName();
if (properties.containsKey(propertyKeyName)) {
return InternalUtils.createInstanceFromClassName(AssertionProvider.class, properties.getProperty(propertyKeyName));
}
return new DefaultAssertionProvider();
}
T requireNonNull(T value);
T requireArgument(T value, Predicate super T> cond);
T requireState(T value, Predicate super T> cond);
T require(T value, Predicate super T> cond);
T validate(T value, Predicate super T> cond) throws AE;
T ensureNonNull(T value);
T ensureState(T value, Predicate super T> cond);
T ensure(T value, Predicate super T> cond);
boolean validation(T value, Predicate super T> cond) throws AE;
boolean that(T value, Predicate super T> cond);
boolean precondition(T value, Predicate super T> cond);
boolean postcondition(T value, Predicate super T> cond);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy