@Test
public void onCreateViewHolder() {

    // 3 elements and each element has it's own viewtype and hence own delegate
    List<Object> items = Arrays.asList(new Object(), new Object(), new Object());
    SpyableAdapterDelegate<List<Object>> d0 = new SpyableAdapterDelegate<>(0);
    SpyableAdapterDelegate<List<Object>> d1 = new SpyableAdapterDelegate<>(1);
    SpyableAdapterDelegate<List<Object>> d2 = new SpyableAdapterDelegate<>(2);
    AdapterDelegatesManager<List<Object>> manager = new AdapterDelegatesManager<>();
    manager.addDelegate(d0);
    manager.addDelegate(d1);
    manager.addDelegate(d2);
    // Test first item
    RecyclerView.ViewHolder vh = manager.onCreateViewHolder(null, 0);
    Assert.assertSame(vh, d0.viewHolder);
    Assert.assertTrue(d0.onCreateViewHolderCalled);
    Assert.assertFalse(d1.onCreateViewHolderCalled);
    Assert.assertFalse(d2.onCreateViewHolderCalled);
    resetDelegates(d0, d1, d2);
    // Test second item
    vh = manager.onCreateViewHolder(null, 1);
    Assert.assertSame(vh, d1.viewHolder);
    Assert.assertTrue(d1.onCreateViewHolderCalled);
    Assert.assertFalse(d0.onCreateViewHolderCalled);
    Assert.assertFalse(d2.onCreateViewHolderCalled);
    resetDelegates(d0, d1, d2);
    // Test second item
    vh = manager.onCreateViewHolder(null, 2);
    Assert.assertSame(vh, d2.viewHolder);
    Assert.assertTrue(d2.onCreateViewHolderCalled);
    Assert.assertFalse(d0.onCreateViewHolderCalled);
    Assert.assertFalse(d1.onCreateViewHolderCalled);
}