@Test @SuppressWarnings("unchecked") public void shouldIncludeIteratorsInToStringRepresentation() throws Exception { Iterable<Iterator<?>> iterators = (Iterable<Iterator<?>>) mock(Iterable.class, RETURNS_MOCKS); ZippedIterator iterator = new ZippedIterator(iterators); when(iterators.toString()).thenReturn("the-iterators"); String toString = iterator.toString(); assertThat(toString, containsString("the-iterators")); }
@Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("iterators", iterators) .toString(); }
ZippedIterator implements Iterator<Iterable<?>> { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("iterators", iterators) .toString(); } }
ZippedIterator implements Iterator<Iterable<?>> { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("iterators", iterators) .toString(); } ZippedIterator(Iterable<? extends Iterator<?>> iterators); }
ZippedIterator implements Iterator<Iterable<?>> { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("iterators", iterators) .toString(); } ZippedIterator(Iterable<? extends Iterator<?>> iterators); boolean hasNext(); Iterable<?> next(); void remove(); @Override String toString(); }
ZippedIterator implements Iterator<Iterable<?>> { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("iterators", iterators) .toString(); } ZippedIterator(Iterable<? extends Iterator<?>> iterators); boolean hasNext(); Iterable<?> next(); void remove(); @Override String toString();  }