@Test public void shouldTransformGeneratedValueUsingSuppliedFunction() { Generator<String> intAsStringGenerator = new TransformingGenerator<>(Generators.ofInstance(5), new Function<Integer, String>() { @Override public String apply(Integer input) { return input.toString(); } }); assertThat(intAsStringGenerator.next(), is("5")); }
@Override public T next() { return function.apply(delegate.next()); }
TransformingGenerator implements Generator<T> { @Override public T next() { return function.apply(delegate.next()); } }
TransformingGenerator implements Generator<T> { @Override public T next() { return function.apply(delegate.next()); } TransformingGenerator(@Nonnull Generator<F> delegate, @Nonnull Function<F, T> function); }
TransformingGenerator implements Generator<T> { @Override public T next() { return function.apply(delegate.next()); } TransformingGenerator(@Nonnull Generator<F> delegate, @Nonnull Function<F, T> function); @Override T next(); }
TransformingGenerator implements Generator<T> { @Override public T next() { return function.apply(delegate.next()); } TransformingGenerator(@Nonnull Generator<F> delegate, @Nonnull Function<F, T> function); @Override T next();  }