@@ -0,0 +1,3304 @@
+package com.bignerdranch.expandablerecyclerview;%0A%0Aimport android.support.annotation.NonNull;%0Aimport android.view.ViewGroup;%0A%0Aimport com.bignerdranch.expandablerecyclerview.model.ParentListItem;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.Mockito;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport static junit.framework.Assert.assertEquals;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Apublic class ExpandableRecyclerAdapterTest %7B%0A%0A    private static class TestExpandableRecyclerAdapter extends ExpandableRecyclerAdapter%3CParentViewHolder, ChildViewHolder%3E %7B%0A%0A        public TestExpandableRecyclerAdapter(@NonNull List%3C? extends ParentListItem%3E parentItemList) %7B%0A            super(parentItemList);%0A        %7D%0A%0A        @Override%0A        public ParentViewHolder onCreateParentViewHolder(ViewGroup parentViewGroup, int viewType) %7B%0A            return null;%0A        %7D%0A%0A        @Override%0A        public ChildViewHolder onCreateChildViewHolder(ViewGroup childViewGroup, int viewType) %7B%0A            return null;%0A        %7D%0A%0A        @Override%0A        public void onBindParentViewHolder(ParentViewHolder parentViewHolder, int parentPosition, ParentListItem parentListItem) %7B%0A%0A        %7D%0A%0A        @Override%0A        public void onBindChildViewHolder(ChildViewHolder childViewHolder, int parentPosition, int childPosition, Object childListItem) %7B%0A%0A        %7D%0A    %7D%0A%0A    private TestExpandableRecyclerAdapter mExpandableRecyclerAdapter;%0A    private List%3CParentListItem%3E mParentListItems;%0A%0A    @Before%0A    public void setup() %7B%0A        mParentListItems = new ArrayList%3C%3E();%0A%0A        for (int i = 0; i %3C 10; i++) %7B%0A            List%3CObject%3E childObjects = new ArrayList%3C%3E();%0A            childObjects.add(new Object());%0A            childObjects.add(new Object());%0A            childObjects.add(new Object());%0A%0A            ParentListItem parentListItem = mock(ParentListItem.class);%0A            Mockito.%3CList%3C?%3E%3Ewhen(parentListItem.getChildItemList()).thenReturn(childObjects);%0A            when(parentListItem.isInitiallyExpanded()).thenReturn(i %25 2 == 0); // Every other parent will return true%0A%0A            mParentListItems.add(parentListItem);%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void adapterCorrectlyInitializesExpandedParents() %7B%0A        mExpandableRecyclerAdapter = new TestExpandableRecyclerAdapter(mParentListItems);%0A%0A        assertEquals(mExpandableRecyclerAdapter.getItemCount(), 25);%0A    %7D%0A%0A    @Test%0A    public void adapterCorrectlyInitializesExpandedParentsWhenAllParentItemsAreInitiallyCollapsed() %7B%0A        for (ParentListItem parentListItem : mParentListItems) %7B%0A            when(parentListItem.isInitiallyExpanded()).thenReturn(false);%0A        %7D%0A        mExpandableRecyclerAdapter = new TestExpandableRecyclerAdapter(mParentListItems);%0A%0A        assertEquals(mExpandableRecyclerAdapter.getItemCount(), 10);%0A    %7D%0A%0A    @Test%0A    public void adapterCorrectlyInitializesExpandedParentsWhenAllParentItemsAreInitiallyExpanded() %7B%0A        for (ParentListItem parentListItem : mParentListItems) %7B%0A            when(parentListItem.isInitiallyExpanded()).thenReturn(true);%0A        %7D%0A        mExpandableRecyclerAdapter = new TestExpandableRecyclerAdapter(mParentListItems);%0A%0A        assertEquals(mExpandableRecyclerAdapter.getItemCount(), 40);%0A    %7D%0A%7D%0A

write tests for initial expansion of items in adapter