All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.jqwik.engine.providers.ArbitraryArbitraryProvider Maven / Gradle / Ivy

The newest version!
package net.jqwik.engine.providers;

import java.util.*;

import net.jqwik.api.*;
import net.jqwik.api.providers.*;
import net.jqwik.api.support.*;

public class ArbitraryArbitraryProvider implements ArbitraryProvider {
	@Override
	public boolean canProvideFor(TypeUsage targetType) {
		return targetType.isOfType(Arbitrary.class);
	}

	@Override
	public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) {
		TypeUsage innerType = targetType.getTypeArguments().get(0);
		return subtypeProvider.apply(innerType).stream()
							  .map(Arbitraries::just)
							  .collect(CollectorsSupport.toLinkedHashSet());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy