### Question:
ListeningGenerator implements Generator<T>, Consumer<T> { @Override public T next() { return value; }  @Override void consume(T value); @Override T next();  }### Answer:
@Test public void shouldGenerateConsumedValues() { ListeningGenerator<Integer> listeningGenerator = new ListeningGenerator<>(); BroadcastingGenerator<Integer> broadcastingGenerator = new BroadcastingGenerator<>(new SequentialIntegerGenerator(), listeningGenerator); assertThat(listeningGenerator.next(), nullValue()); Integer firstInteger = broadcastingGenerator.next(); assertThat(listeningGenerator.next(), is(firstInteger)); Integer secondInteger = broadcastingGenerator.next(); assertThat(listeningGenerator.next(), is(secondInteger)); Integer thirdInteger = broadcastingGenerator.next(); assertThat(listeningGenerator.next(), is(thirdInteger)); }