@Test public void getItemShouldIgnoreMeAfterSort() { final User penny = new User("Penny", 1); final User amy = new User("Amy", 2); final User que = new User("Que", 3); final User fido = new User("Fido", 4); adapter.add(me); adapter.add(penny); adapter.add(amy); adapter.add(que); adapter.add(fido); assertEquals(4, adapter.getCount()); assertSame(amy, adapter.getItem(0)); assertSame(fido, adapter.getItem(1)); assertSame(penny, adapter.getItem(2)); assertSame(que, adapter.getItem(3)); }
@Test public void getItemShouldIgnoreMe() { final User test1 = new User("Test1", 1); final User test2 = new User("Test2", 2); final User test3 = new User("Test3", 3); final User test4 = new User("Test4", 4); adapter.add(test1); adapter.add(test2); adapter.add(me); adapter.add(test3); adapter.add(test4); assertEquals(4, adapter.getCount()); assertSame(test1, adapter.getItem(0)); assertSame(test2, adapter.getItem(1)); assertSame(test3, adapter.getItem(2)); assertSame(test4, adapter.getItem(3)); }
@Test public void getCountShouldBe0WhenOnlyMe() { adapter.add(me); assertEquals(0, adapter.getCount()); }
@Test(expected = IndexOutOfBoundsException.class) public void getItem0ShouldGiveIndexOutOfBoundsExceptionWhenOnlyMe() { adapter.add(me); assertNull(adapter.getItem(0)); }