### Question:
FilteredGenerator extends BaseGenerator<E> { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof FilteredGenerator<?>)) { return false; } FilteredGenerator<?> other = (FilteredGenerator<?>) obj; return other.getWrappedGenerator().equals(getWrappedGenerator()) && other.pred.equals(pred); } FilteredGenerator(Generator<? extends E> wrapped, Predicate<? super E> pred); void run(Procedure<? super E> proc); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void testEquals() { Generator<Integer> anotherGenerate = new FilteredGenerator<Integer>( IteratorToGeneratorAdapter.adapt(new IntegerRange(1, 10)), isEven); assertEquals(filteredGenerator, filteredGenerator); assertEquals(filteredGenerator, anotherGenerate); assertTrue(!filteredGenerator.equals((FilteredGenerator<Integer>)null)); Generator<Integer> aGenerateWithADifferentPredicate = new FilteredGenerator<Integer>( IteratorToGeneratorAdapter.adapt(new IntegerRange(1, 10)), new Predicate<Integer>() { public boolean test(Integer obj) { return obj % 2 == 0; } }); assertTrue(!filteredGenerator.equals(aGenerateWithADifferentPredicate)); Generator<Integer> aGenerateWithADifferentWrapped = new FilteredGenerator<Integer>( IteratorToGeneratorAdapter.adapt(new IntegerRange(1,11)), isEven); assertTrue(!filteredGenerator.equals(aGenerateWithADifferentWrapped)); }