/** * Constructs a MultiTypeAdapter with a items list. * * @param items the items list */ public MultiTypeAdapter(@NonNull List<?> items) { this(items, new MultiTypePool()); }
@Before public void register() { pool = new MultiTypePool(); pool.register(TestItem.class, new TestItemViewBinder(), new DefaultLinker<TestItem>()); pool.register(RegisteredSubClass.class, new TestItemViewBinder(), new DefaultLinker<TestItem>()); }
@Test public void shouldIndexOfReturn1WithRegisterSubclass() { assertEquals(1, pool.firstIndexOf(RegisteredSubClass.class)); } }
@Test public void shouldIndexOfReturn0WithNonRegisterSubclass() { assertEquals(0, pool.firstIndexOf(SubClass.class)); }
/** * Constructs a MultiTypeAdapter with a items list and an initial capacity of TypePool. * * @param items the items list * @param initialCapacity the initial capacity of TypePool */ public MultiTypeAdapter(@NonNull List<?> items, int initialCapacity) { this(items, new MultiTypePool(initialCapacity)); }
@Test public void shouldIndexOfReturn0() { assertEquals(0, pool.firstIndexOf(TestItem.class)); }