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

autofixture.generators.throwables.ExceptionGenerator Maven / Gradle / Ivy

package autofixture.generators.throwables;

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

public class ExceptionGenerator implements InstanceGenerator {

  @Override
  public  boolean appliesTo(final InstanceType instanceType) {
    return instanceType.isRawTypeAssignableFrom(Exception.class);
  }

  @SuppressWarnings("unchecked")
  @Override
  public  T next(final InstanceType instanceType, final FixtureContract fixture) {
    return (T) new Exception(fixture.create(String.class));
  }

  @Override
  public  T nextEmpty(final InstanceType instanceType, final FixtureContract fixture) {
    return next(instanceType, fixture);
  }

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy