@Test public void testExpandedGroupCountForAddAll() throws Exception { ExpandableGroup expandableGroup = new ExpandableGroup(parent); List<DummyItem> items = new ArrayList<>(); int itemsCount = 5; for (int i = 0; i < itemsCount; i++) { items.add(new DummyItem()); } expandableGroup.addAll(items); expandableGroup.registerGroupDataObserver(groupAdapter); expandableGroup.onToggleExpanded(); assertEquals(6, expandableGroup.getGroupCount()); }
@Test public void testExpandedGroupCountForRemove() throws Exception { ExpandableGroup expandableGroup = new ExpandableGroup(parent); List<DummyItem> items = new ArrayList<>(); int itemsCount = 5; for (int i = 0; i < itemsCount; i++) { items.add(new DummyItem()); } expandableGroup.addAll(items); expandableGroup.registerGroupDataObserver(groupAdapter); expandableGroup.remove(items.get(0)); expandableGroup.onToggleExpanded(); assertEquals(5, expandableGroup.getGroupCount()); }
@Test public void testGroupCountForRemoveAll() throws Exception { ExpandableGroup expandableGroup = new ExpandableGroup(parent); List<DummyItem> items = new ArrayList<>(); int itemsCount = 5; for (int i = 0; i < itemsCount; i++) { items.add(new DummyItem()); } expandableGroup.addAll(items); expandableGroup.registerGroupDataObserver(groupAdapter); expandableGroup.removeAll(items); expandableGroup.onToggleExpanded(); assertEquals(1, expandableGroup.getGroupCount()); } }
@Test public void testExpandedGroupCountForAdd() throws Exception { ExpandableGroup expandableGroup = new ExpandableGroup(parent); DummyItem item = new DummyItem(); expandableGroup.add(item); expandableGroup.registerGroupDataObserver(groupAdapter); expandableGroup.onToggleExpanded(); assertEquals(2, expandableGroup.getGroupCount()); }
@Test public void testUnexpandedGroupCount() throws Exception { ExpandableGroup expandableGroup = new ExpandableGroup(parent); Section section = new Section(); int sectionSize = 5; for (int i = 0; i < sectionSize; i++) { section.add(new DummyItem()); } expandableGroup.add(section); Item lastItem = new DummyItem(); expandableGroup.add(lastItem); assertEquals(1, expandableGroup.getGroupCount()); }
@Test public void testExpandedGroupCount() throws Exception { ExpandableGroup expandableGroup = new ExpandableGroup(parent); Section section = new Section(); int sectionSize = 5; for (int i = 0; i < sectionSize; i++) { section.add(new DummyItem()); } expandableGroup.add(section); Item lastItem = new DummyItem(); expandableGroup.add(lastItem); expandableGroup.registerGroupDataObserver(groupAdapter); expandableGroup.onToggleExpanded(); assertEquals(3, expandableGroup.getGroupCount()); }