![JAR search and dependency download from the Maven repository](/logo.png)
autofixture.generators.collections.EmptyArraysGenerator 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.collections;
import autofixture.interfaces.FixtureContract;
import autofixture.interfaces.InstanceGenerator;
import autofixture.interfaces.InstanceType;
/**
* Created by grzes on 22.03.2017.
*/
public class EmptyArraysGenerator implements InstanceGenerator {
@Override
public boolean appliesTo(final InstanceType clazz) {
return clazz.isArray();
}
@SuppressWarnings("unchecked")
@Override
public T next(final InstanceType type, final FixtureContract fixture) {
final InstanceType> componentType = type.getArrayElementType();
final Object array = componentType.createEmptyArray();
final T stronglyTypedArray = (T) array;
return stronglyTypedArray;
}
@Override
public void setOmittingAutoProperties(final boolean isOn) {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy