net.jqwik.engine.properties.ProviderMethodInvoker Maven / Gradle / Ivy
package net.jqwik.engine.properties;
import java.lang.reflect.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
import net.jqwik.api.*;
import net.jqwik.api.providers.ArbitraryProvider.*;
import net.jqwik.api.providers.*;
import net.jqwik.engine.support.*;
import net.jqwik.engine.support.types.*;
import static net.jqwik.engine.support.JqwikReflectionSupport.*;
class ProviderMethodInvoker {
ProviderMethodInvoker(Method providerMethod, TypeUsage targetType, Object instance, SubtypeProvider subtypeProvider) {
this.providerMethod = providerMethod;
this.targetType = targetType;
this.instance = instance;
this.subtypeProvider = subtypeProvider;
}
private final Method providerMethod;
private final TypeUsage targetType;
private final Object instance;
private final SubtypeProvider subtypeProvider;
Set> invoke() {
List parameters = JqwikReflectionSupport.getMethodParameters(providerMethod, instance.getClass());
Set, Arbitrary>>> baseInvoker = Collections.singleton(this::invokeProviderMethod);
Set>> suppliers = arbitrarySuppliers(baseInvoker, parameters, Collections.emptyList());
return mapSet(suppliers, Supplier::get);
}
private Arbitrary> invokeProviderMethod(List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy