Search in sources :

Example 1 with EfficientCacheView

use of com.skocken.efficientadapter.lib.util.EfficientCacheView in project Presentation by StanKocken.

the class BaseViewProxyTest method testShouldCallEfficientCacheViewMethod.

@Test
public void testShouldCallEfficientCacheViewMethod() {
    View rootView = Mockito.mock(View.class);
    final EfficientCacheView efficientCacheView = Mockito.mock(EfficientCacheView.class);
    BaseViewProxy baseViewProxy = new BaseViewProxy(rootView) {

        @NonNull
        @Override
        EfficientCacheView createCacheView(View rootView) {
            return efficientCacheView;
        }
    };
    verify(efficientCacheView, times(0)).clearViewsCached();
    baseViewProxy.clearViewsCached();
    verify(efficientCacheView, times(1)).clearViewsCached();
    int viewId = 1234;
    verify(efficientCacheView, times(0)).clearViewCached(viewId);
    baseViewProxy.clearViewCached(viewId);
    verify(efficientCacheView, times(1)).clearViewCached(viewId);
    int parentId = 456;
    verify(efficientCacheView, times(0)).clearViewCached(parentId, viewId);
    baseViewProxy.clearViewCached(parentId, viewId);
    verify(efficientCacheView, times(1)).clearViewCached(parentId, viewId);
    verify(efficientCacheView, times(0)).findViewByIdEfficient(viewId);
    baseViewProxy.findViewByIdEfficient(viewId);
    verify(efficientCacheView, times(1)).findViewByIdEfficient(viewId);
    verify(efficientCacheView, times(0)).findViewByIdEfficient(parentId, viewId);
    baseViewProxy.findViewByIdEfficient(parentId, viewId);
    verify(efficientCacheView, times(1)).findViewByIdEfficient(parentId, viewId);
}
Also used : EfficientCacheView(com.skocken.efficientadapter.lib.util.EfficientCacheView) EfficientCacheView(com.skocken.efficientadapter.lib.util.EfficientCacheView) View(android.view.View) Test(org.junit.Test)

Aggregations

View (android.view.View)1 EfficientCacheView (com.skocken.efficientadapter.lib.util.EfficientCacheView)1 Test (org.junit.Test)1