@Test(expected = NoSuchElementException.class)
 public void testHasNextError() {
   ReversibleAdapter<String> a = new ReversibleAdapter<>("1", "2", "3");
   ReversibleAdapter<String> b = new ReversibleAdapter<>("a");
   Interleaver<String> interleaver = new Interleaver<>(a, b);
   assertEquals("1", interleaver.next());
   assertEquals("a", interleaver.next());
   assertEquals("2", interleaver.next());
   assertEquals("3", interleaver.next());
   assertFalse(interleaver.hasNext());
   interleaver.next();
 }
  @Test
  public void testInterleaver() {

    ReversibleAdapter<String> a = new ReversibleAdapter<>("1", "2", "3");
    ReversibleAdapter<String> b = new ReversibleAdapter<>("Z");
    ReversibleAdapter<String> c = new ReversibleAdapter<>("a", "b", "c");

    Interleaver<String> interleaver = new Interleaver<>(a, b, c);

    assertEquals("1", interleaver.next());
    assertEquals("Z", interleaver.next());
    assertEquals("a", interleaver.next());
    assertEquals("2", interleaver.next());
    assertEquals("b", interleaver.next());
    assertEquals("3", interleaver.next());
    assertEquals("c", interleaver.next());
    assertFalse(interleaver.hasNext());

    assertEquals("c", interleaver.previous());
    assertEquals("3", interleaver.previous());
    assertEquals("b", interleaver.previous());
    assertEquals("2", interleaver.previous());
    assertEquals("a", interleaver.previous());
    assertEquals("Z", interleaver.previous());
    assertEquals("1", interleaver.previous());
    assertFalse(interleaver.hasPrevious());

    assertEquals("1", interleaver.next());
    assertEquals("Z", interleaver.next());
    assertEquals("a", interleaver.next());
    assertEquals("2", interleaver.next());
    assertTrue(interleaver.hasNext());
    assertTrue(interleaver.hasPrevious());
    assertEquals("2", interleaver.previous());
    assertEquals("a", interleaver.previous());
    assertEquals("Z", interleaver.previous());
    assertEquals("1", interleaver.previous());
    assertFalse(interleaver.hasPrevious());
  }