@Test public void shouldGenerateTypeUsingBuilder() { given(carBuilder.build()).willReturn(car1, car2, car3); Generator<Car> fromBuilderGenerator = new FromBuilderGenerator<>(carBuilder); assertThat(fromBuilderGenerator.next(), sameInstance(car1)); assertThat(fromBuilderGenerator.next(), sameInstance(car2)); assertThat(fromBuilderGenerator.next(), sameInstance(car3)); }
@Override public T next() { return builder.build(); }
FromBuilderGenerator implements Generator<T> { @Override public T next() { return builder.build(); } }
FromBuilderGenerator implements Generator<T> { @Override public T next() { return builder.build(); } FromBuilderGenerator(@Nonnull Builder<T> builder); }
FromBuilderGenerator implements Generator<T> { @Override public T next() { return builder.build(); } FromBuilderGenerator(@Nonnull Builder<T> builder); @Override T next(); }
FromBuilderGenerator implements Generator<T> { @Override public T next() { return builder.build(); } FromBuilderGenerator(@Nonnull Builder<T> builder); @Override T next();  }