@Test public void shouldIncludeTheMappingFunctionInTheToStringRepresentation() throws Exception { UnaryFunction<Integer, Integer> mapper = new UnaryFunction<Integer, Integer>() { @Override public Integer call(Integer integer) { throw new NotImplementedException(); } @Override public String toString() { return "some-mapping-function"; } }; Iterator<Integer> input = listWith(1, 2, 3).iterator(); Predicate<Integer> predicate = Predicates.alwaysTrue(); ComprehensionIterator<Integer, Integer> iterator = new ComprehensionIterator<Integer, Integer>(mapper, input, listWith(predicate)); String toString = iterator.toString(); assertThat(toString, containsString("some-mapping-function")); }
@Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("mapper", mapper) .append("iterator", iterator) .append("predicates", predicates) .toString(); }
ComprehensionIterator extends CachingIterator<T> { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("mapper", mapper) .append("iterator", iterator) .append("predicates", predicates) .toString(); } }
ComprehensionIterator extends CachingIterator<T> { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("mapper", mapper) .append("iterator", iterator) .append("predicates", predicates) .toString(); } ComprehensionIterator(
            UnaryFunction<? super S, T> mapper,
            Iterator<S> iterator,
            Iterable<? extends UnaryPredicate<? super S>> predicates); }
ComprehensionIterator extends CachingIterator<T> { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("mapper", mapper) .append("iterator", iterator) .append("predicates", predicates) .toString(); } ComprehensionIterator(
            UnaryFunction<? super S, T> mapper,
            Iterator<S> iterator,
            Iterable<? extends UnaryPredicate<? super S>> predicates); @Override String toString(); }
ComprehensionIterator extends CachingIterator<T> { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("mapper", mapper) .append("iterator", iterator) .append("predicates", predicates) .toString(); } ComprehensionIterator(
            UnaryFunction<? super S, T> mapper,
            Iterator<S> iterator,
            Iterable<? extends UnaryPredicate<? super S>> predicates); @Override String toString();  }