### Question:
UntilGenerate extends LoopGenerator<E> { public void run(final Procedure<? super E> proc) { getWrappedGenerator().run(new Procedure<E>() { public void run(E obj) { if (test.test(obj)) { UntilGenerate.this.stop(); } else { proc.run(obj); } } }); } UntilGenerate(Predicate<? super E> test, Generator<? extends E> wrapped); void run(final Procedure<? super E> proc); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void testGenerate() { final List<Integer> numbersGreaterThanFive = new ArrayList<Integer>(); untilGenerate.run(new Procedure<Integer>() { public void run( Integer obj ) { numbersGreaterThanFive.add(obj); } }); assertEquals(5, numbersGreaterThanFive.size()); final List<Integer> expected = Arrays.asList(1, 2, 3, 4, 5); assertEquals(expected, numbersGreaterThanFive); }