public void testD() {
    D e = new D();
    List<Integer> expected = Arrays.asList(2, 3, 4);
    InitHelper.init(e);
    assertEquals(e.invocations.size(), 3);
    assertEquals(e.invocations, expected);

    expected = Arrays.asList(-4, -3, -2);
    e.invocations.clear();
    InitHelper.destroy(e);
    assertEquals(e.invocations.size(), 3);
    assertEquals(e.invocations, expected);
  }
  public void testB() {
    B b = new B();
    List<Integer> expected = Arrays.asList(1, 2, 3);
    InitHelper.init(b);
    assertEquals(b.invocations.size(), 3);
    assertListEqualsPermuted(b.invocations, expected, 0, 3);
    assertListIndexEquals(b.invocations, expected, 2);

    expected = Arrays.asList(-3, -2, -1);
    b.invocations.clear();
    InitHelper.destroy(b);
    assertEquals(b.invocations.size(), 3);
    assertListIndexEquals(b.invocations, expected, 0);
    assertListEqualsPermuted(b.invocations, expected, 1, 3);
  }
  public void testC() {
    C c = new C();
    List<Integer> expected = Arrays.asList(4, 2, 3);
    InitHelper.init(c);
    assertEquals(c.invocations.size(), 3);
    assertListEqualsPermuted(c.invocations, expected, 0, 2);
    assertListIndexEquals(c.invocations, expected, 2);

    expected = Arrays.asList(-3, -2, -4);
    c.invocations.clear();
    InitHelper.destroy(c);
    assertEquals(c.invocations.size(), 3);
    assertListIndexEquals(c.invocations, expected, 0);
    assertListEqualsPermuted(c.invocations, expected, 1, 3);
  }
 public void testE() {
   E d = new E();
   InitHelper.init(d);
   InitHelper.destroy(d);
   Assert.assertEquals(d.invocations, Arrays.asList(1, -1));
 }