![JAR search and dependency download from the Maven repository](/logo.png)
autofixture.generators.objects.ObjenesisGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of autofixturegenerator Show documentation
Show all versions of autofixturegenerator Show documentation
An attempt to reimplement core features of a popular .NET anonymous value generator - AutoFixture - in
Java
package autofixture.generators.objects;
/*
* Copyright (c) 2016 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
import autofixture.interfaces.FixtureContract;
import autofixture.interfaces.InstanceGenerator;
import autofixture.interfaces.InstanceType;
import org.objenesis.ObjenesisStd;
public class ObjenesisGenerator implements InstanceGenerator {
private final ObjenesisStd objenesis = new ObjenesisStd(true);
@Override
public boolean appliesTo(InstanceType instanceType) {
return true;
}
@Override
public T next(InstanceType instanceType, FixtureContract fixture) {
return objenesis.newInstance((Class)instanceType.getRawType());
}
@Override
public void setOmittingAutoProperties(boolean isOn) {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy