public void testEmptyIteratorsInTheMiddle() {
   final IteratorChain<String> c = new IteratorChain<>();
   c.addIterator(makeIterator("a", 3));
   c.addIterator(makeIterator("b", 0));
   c.addIterator(makeIterator("c", 1));
   assertEquals("a1a2a3c1", getString(c));
 }
 public void testRemove() {
   final IteratorChain<String> c = new IteratorChain<>();
   try {
     c.remove();
     fail("Calling remove should throw UnsupportedOperationException");
   } catch (UnsupportedOperationException asExpected) {
     // we're fine
   }
 }
 public void testCallAddTooLate() {
   final IteratorChain<String> c = new IteratorChain<>();
   c.hasNext();
   try {
     c.addIterator(makeIterator("a", 3));
     fail("Calling addIterator after hasNext() should throw RuntimeException");
   } catch (RuntimeException asExpected) {
     // we're fine
   }
 }
 public void testCallNextTooEarly() {
   final IteratorChain<String> c = new IteratorChain<>();
   c.addIterator(makeIterator("a", 3));
   try {
     c.next();
     fail("Calling next() before hasNext() should throw RuntimeException");
   } catch (RuntimeException asExpected) {
     // we're fine
   }
 }
 public void testTwoIterators() {
   final IteratorChain<String> c = new IteratorChain<>();
   c.addIterator(makeIterator("a", 3));
   c.addIterator(makeIterator("b", 2));
   assertEquals("a1a2a3b1b2", getString(c));
 }
 public void testOneIterator() {
   final IteratorChain<String> c = new IteratorChain<>();
   c.addIterator(makeIterator("a", 3));
   assertEquals("a1a2a3", getString(c));
 }
 public void testNoIterator() {
   final IteratorChain<String> c = new IteratorChain<>();
   assertFalse("Empty IteratorChain.hastNext() is false", c.hasNext());
   assertEquals("", getString(c));
 }