@@ -0,0 +1,2705 @@
+package se.snylt.zipper.viewbinder.viewfinder;%0A%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.Mock;%0Aimport org.mockito.MockitoAnnotations;%0Aimport org.mockito.invocation.InvocationOnMock;%0Aimport org.mockito.stubbing.Answer;%0A%0Aimport android.view.View;%0A%0Aimport java.util.HashMap;%0A%0Aimport se.snylt.zipper.viewbinder.Binder;%0A%0Aimport static junit.framework.Assert.assertSame;%0Aimport static org.mockito.ArgumentMatchers.any;%0Aimport static org.mockito.ArgumentMatchers.eq;%0Aimport static org.mockito.Mockito.doAnswer;%0Aimport static org.mockito.Mockito.doReturn;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Apublic class ViewViewFinderTest %7B%0A%0A    @Mock%0A    View view;%0A%0A    HashMap%3CObject, Object%3E tagged;%0A%0A    private final static int TAG = 666;%0A%0A    private ViewViewFinder viewFinder;%0A%0A    @Before%0A    public void setup()%7B%0A        MockitoAnnotations.initMocks(this);%0A        viewFinder = new ViewViewFinder(view, TAG);%0A%0A        makeViewTaggable();%0A    %7D%0A%0A    private void makeViewTaggable() %7B%0A        tagged = new HashMap%3C%3E();%0A%0A        when(view.getTag(eq(TAG))).thenAnswer(new Answer%3CObject%3E() %7B%0A            @Override%0A            public Object answer(InvocationOnMock invocation) throws Throwable %7B%0A                return tagged.get(invocation.getArgument(0));%0A            %7D%0A        %7D);%0A%0A        doAnswer(new Answer() %7B%0A            @Override%0A            public Object answer(InvocationOnMock invocation) throws Throwable %7B%0A                tagged.put(invocation.getArgument(0), invocation.getArgument(1));%0A                return null;%0A            %7D%0A        %7D).when(view).setTag(eq(TAG), any(Object.class));%0A    %7D%0A%0A    @Test%0A    public void getRoot_Should_ReturnView()%7B%0A        assertSame(view, viewFinder.getRoot());%0A    %7D%0A%0A    @Test%0A    public void getTag_Should_ReturnTag()%7B%0A        assertSame(TAG, viewFinder.getTag());%0A    %7D%0A%0A    @Test%0A    public void findViewById_Should_FindViewInView()%7B%0A        View viewInView = mock(View.class);%0A        doReturn(viewInView).when(view).findViewById(eq(1));%0A%0A        assertSame(viewInView, viewFinder.findViewById(1));%0A    %7D%0A%0A    @Test%0A    public void putViewHolder_Should_StoreViewHolderWithKey()%7B%0A        Object key = new Object();%0A        Object viewHolder = new Object();%0A%0A        // When%0A        viewFinder.putViewHolder(key, viewHolder);%0A%0A        // Then%0A        assertSame(viewHolder, viewFinder.getViewHolder(key));%0A    %7D%0A%0A    @Test%0A    public void putBinder_Should_StoreBinderWithKey()%7B%0A        Object key = new Object();%0A        Binder binder = mock(Binder.class);%0A%0A        // When%0A        viewFinder.putBinder(key, binder);%0A%0A        // Then%0A        assertSame(binder, viewFinder.getBinder(key));%0A    %7D%0A%0A%7D

Test view finder.