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

autofixture.publicinterface.inline.FromGenerator Maven / Gradle / Ivy

package autofixture.publicinterface.inline;

import autofixture.implementationdetails.InstanceCursor;
import autofixture.interfaces.FixtureContract;
import autofixture.interfaces.InlineInstanceGenerator;

public class FromGenerator implements InlineInstanceGenerator {
  private final T[] possibleValues;
  private InstanceCursor cursor;

  public FromGenerator(final InstanceCursor instanceCursor,
                       final T... possibleValues) {
    this.possibleValues = possibleValues;
    cursor = instanceCursor;

  }

  public T next(FixtureContract fixture) {
    final T returnedValue = cursor.selectFrom(possibleValues);

    cursor.advance();
    cursor.save();

    return returnedValue;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy