### Question:
SwipeRefreshLayout extends ViewGroup implements NestedScrollingParent,
        NestedScrollingChild { public void setOnChildScrollUpCallback(@Nullable OnChildScrollUpCallback callback) { mChildScrollUpCallback = callback; } SwipeRefreshLayout(@NonNull Context context);  SwipeRefreshLayout(@NonNull Context context, @Nullable AttributeSet attrs); @Override void setEnabled(boolean enabled); void setProgressViewOffset(boolean scale, int start, int end); int getProgressViewStartOffset(); int getProgressViewEndOffset(); void setProgressViewEndTarget(boolean scale, int end); void setSlingshotDistance(@Px int slingshotDistance); void setSize(int size); void setOnRefreshListener(@Nullable OnRefreshListener listener); void setRefreshing(boolean refreshing); @Deprecated void setProgressBackgroundColor(int colorRes); void setProgressBackgroundColorSchemeResource(@ColorRes int colorRes); void setProgressBackgroundColorSchemeColor(@ColorInt int color); @Deprecated void setColorScheme(@ColorRes int... colors); void setColorSchemeResources(@ColorRes int... colorResIds); void setColorSchemeColors(@ColorInt int... colors); boolean isRefreshing(); void setDistanceToTriggerSync(int distance); @Override void onMeasure(int widthMeasureSpec, int heightMeasureSpec); int getProgressCircleDiameter(); boolean canChildScrollUp(); void setOnChildScrollUpCallback(@Nullable OnChildScrollUpCallback callback); @Override boolean onInterceptTouchEvent(MotionEvent ev); @Override void requestDisallowInterceptTouchEvent(boolean b); @Override boolean onStartNestedScroll(View child, View target, int nestedScrollAxes); @Override void onNestedScrollAccepted(View child, View target, int axes); @Override void onNestedPreScroll(View target, int dx, int dy, int[] consumed); @Override int getNestedScrollAxes(); @Override void onStopNestedScroll(View target); @Override void onNestedScroll(final View target, final int dxConsumed, final int dyConsumed,
            final int dxUnconsumed, final int dyUnconsumed); @Override void setNestedScrollingEnabled(boolean enabled); @Override boolean isNestedScrollingEnabled(); @Override boolean startNestedScroll(int axes); @Override void stopNestedScroll(); @Override boolean hasNestedScrollingParent(); @Override boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed,
            int dyUnconsumed, int[] offsetInWindow); @Override boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow); @Override boolean onNestedPreFling(View target, float velocityX,
            float velocityY); @Override boolean onNestedFling(View target, float velocityX, float velocityY,
            boolean consumed); @Override boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed); @Override boolean dispatchNestedPreFling(float velocityX, float velocityY); @Override boolean onTouchEvent(MotionEvent ev); static final int LARGE; static final int DEFAULT; static final int DEFAULT_SLINGSHOT_DISTANCE; }### Answer:
@Test @SmallTest public void testSetOnChildScrollUpCallback() throws Throwable { SwipeRefreshLayout.OnChildScrollUpCallback mockCallback = mock(SwipeRefreshLayout.OnChildScrollUpCallback.class); when(mockCallback.canChildScrollUp(eq(mSwipeRefresh), any(View.class))) .thenReturn(true) .thenReturn(true) .thenReturn(false) .thenReturn(false); mSwipeRefresh.setOnChildScrollUpCallback(mockCallback); assertTrue(mSwipeRefresh.canChildScrollUp()); assertTrue(mSwipeRefresh.canChildScrollUp()); assertFalse(mSwipeRefresh.canChildScrollUp()); assertFalse(mSwipeRefresh.canChildScrollUp()); }