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

autofixture.generators.collections.EmptyMapGenerator Maven / Gradle / Ivy

Go to download

An attempt to reimplement core features of a popular .NET anonymous value generator - AutoFixture - in Java

There is a newer version: 2.1.10
Show newest version
package autofixture.generators.collections;

import autofixture.interfaces.FixtureContract;
import autofixture.interfaces.InstanceGenerator;
import autofixture.interfaces.InstanceType;

import java.util.Map;

/**
 * Created by grzes on 24.03.2017.
 */
public class EmptyMapGenerator implements InstanceGenerator {
  @Override
  public  boolean appliesTo(final InstanceType clazz) {
    return clazz.isMap();
  }

  @SuppressWarnings({"unchecked", "rawtypes"})
  @Override
  public  T next(final InstanceType type, final FixtureContract fixture) {
    //TODO make same as array generation
    final Map map = type.createEmptyMap();
    return (T) map;
  }

  @Override
  public void setOmittingAutoProperties(final boolean isOn) {
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy