@Test @SuppressWarnings("unchecked") public void shouldIncludeTheIteratorFunctionInTheToStringRepresentation() throws Exception { UnaryFunction<Integer, Integer> mapper = UnaryFunctions.identity(); Iterator<Integer> input = (Iterator<Integer>) mock(Iterator.class); Predicate<Integer> predicate = Predicates.alwaysTrue(); when(input.toString()).thenReturn("the-iterator"); ComprehensionIterator<Integer, Integer> iterator = new ComprehensionIterator<Integer, Integer>(mapper, input, listWith(predicate)); String toString = iterator.toString(); assertThat(toString, containsString("the-iterator")); }
@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();  }