@Test
public void getViewType() {

    AdapterDelegatesManager<List> manager = new AdapterDelegatesManager<>();
    try {
        manager.getViewType(null);
        Assert.fail("Nullpointer Exception expected");
    } catch (NullPointerException e) {
    }
    SpyableAdapterDelegate<List> delegate1 = new SpyableAdapterDelegate<>(0);
    SpyableAdapterDelegate<List> delegate2 = new SpyableAdapterDelegate<>(1);
    Assert.assertEquals(-1, manager.getViewType(delegate1));
    Assert.assertEquals(-1, manager.getViewType(delegate2));
    manager.addDelegate(delegate1);
    manager.addDelegate(delegate2);
    Assert.assertEquals(0, manager.getViewType(delegate1));
    Assert.assertEquals(1, manager.getViewType(delegate2));
    SpyableAdapterDelegate<List> delegate3 = new SpyableAdapterDelegate<>(2);
    SpyableAdapterDelegate<List> delegate4 = new SpyableAdapterDelegate<>(3);
    manager.addDelegate(4, delegate4);
    Assert.assertEquals(4, manager.getViewType(delegate4));
    manager.addDelegate(delegate3);
    Assert.assertEquals(3, manager.getViewType(delegate3));
}