SizeViewHolder extends AbstractViewHolder { @Override public void onFinish(boolean done) { if (done) { onShown(); } else { onHidden(); } } SizeViewHolder(int minHeight, int maxHeight); int getHeight(); void setMinHeight(int minHeight); int getMaxHeight(); int getMinHeight(); void setMaxHeight(int maxHeight); @Override void onFinish(boolean done); void onShown(); void onHidden();  }
@Test public void testOnFinishDone() throws Exception { View view = mViewHolder.getView(); ViewGroup.LayoutParams params = mock(ViewGroup.LayoutParams.class); when(view.getLayoutParams()).thenReturn(params); mViewHolder.onFinish(true); verify(view).setVisibility(View.VISIBLE); assertEquals(ViewGroup.LayoutParams.WRAP_CONTENT, params.height); }
@Test public void testOnFinishNotDone() throws Exception { View view = mViewHolder.getView(); ViewGroup.LayoutParams params = mock(ViewGroup.LayoutParams.class); when(view.getLayoutParams()).thenReturn(params); mViewHolder.onFinish(false); verify(view).setVisibility(View.GONE); assertEquals(ViewGroup.LayoutParams.WRAP_CONTENT, params.height); }