com.flextrade.jfixture.builders.GenericConstructorRelay Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jfixture Show documentation
Show all versions of jfixture Show documentation
JFixture is an open source library based on the popular .NET library, AutoFixture
package com.flextrade.jfixture.builders;
import com.flextrade.jfixture.NoSpecimen;
import com.flextrade.jfixture.SpecimenBuilder;
import com.flextrade.jfixture.SpecimenContext;
import com.flextrade.jfixture.exceptions.ObjectCreationException;
import com.flextrade.jfixture.requests.GenericConstructorRequest;
import com.flextrade.jfixture.utility.ParameterUtils;
import com.flextrade.jfixture.utility.SpecimenType;
import java.lang.reflect.Constructor;
import java.util.List;
class GenericConstructorRelay implements SpecimenBuilder {
@Override
public Object create(Object request, SpecimenContext context) {
if (!(request instanceof GenericConstructorRequest)) {
return new NoSpecimen();
}
GenericConstructorRequest genericConstructorRequest = (GenericConstructorRequest) request;
Constructor constructor = genericConstructorRequest.getConstructor();
SpecimenType specimenType = genericConstructorRequest.getContainingType();
List