@Test
 public void testEmpty() {
   Interleaver<String> interleaver = new Interleaver<>();
   assertFalse(interleaver.hasNext());
   assertFalse(interleaver.hasPrevious());
   interleaver = new Interleaver<>(new ReversibleAdapter<>());
   assertFalse(interleaver.hasNext());
   assertFalse(interleaver.hasPrevious());
 }
 @Test(expected = NoSuchElementException.class)
 public void testHasPreviousError() {
   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("a", interleaver.previous());
   assertEquals("1", interleaver.previous());
   assertFalse(interleaver.hasPrevious());
   interleaver.previous();
 }
  @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());
  }