@Test public void shouldIncludeBatchSizeInToString() throws Exception { Iterator<Integer> input = iteratorWith(1, 2, 3, 4); Integer batchSize = 10; BatchedIterator<Integer> batchedIterator = new BatchedIterator<Integer>(input, batchSize); String toString = batchedIterator.toString(); assertThat(toString, containsString("10")); }
@Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("batchSize", batchSize) .append("iterator", iterator.toString()) .toString(); }
BatchedIterator implements Iterator<Iterable<T>> { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("batchSize", batchSize) .append("iterator", iterator.toString()) .toString(); } }
BatchedIterator implements Iterator<Iterable<T>> { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("batchSize", batchSize) .append("iterator", iterator.toString()) .toString(); } BatchedIterator(Iterator<? extends T> iterator, int batchSize); }
BatchedIterator implements Iterator<Iterable<T>> { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("batchSize", batchSize) .append("iterator", iterator.toString()) .toString(); } BatchedIterator(Iterator<? extends T> iterator, int batchSize); @Override boolean hasNext(); @Override Iterable<T> next(); @Override void remove(); @Override String toString(); }
BatchedIterator implements Iterator<Iterable<T>> { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("batchSize", batchSize) .append("iterator", iterator.toString()) .toString(); } BatchedIterator(Iterator<? extends T> iterator, int batchSize); @Override boolean hasNext(); @Override Iterable<T> next(); @Override void remove(); @Override String toString();  }