DefaultScreenInfoProvider implements IScreenInfoProvider { @Override public int getScreenHeightInPixels() { DisplayMetrics displayMetrics = mContext.getResources().getDisplayMetrics(); return displayMetrics.heightPixels; } DefaultScreenInfoProvider(final Context context); @Override int getScreenHeightInPixels(); @Override int getScreenWidthInPixels();  }
@Test public void getScreenHeightInPixelsTest() throws Exception { when(mMockContext.getResources()).thenReturn(mMockedResources); when(mMockedResources.getDisplayMetrics()).thenReturn(mDisplayMetrics); assert (mScreenInfoProvider.getScreenHeightInPixels() == mDisplayMetrics.heightPixels); verify(mMockContext, times(1)).getResources(); verify(mMockedResources, times(1)).getDisplayMetrics(); verifyNoMoreInteractions(mMockContext); verifyNoMoreInteractions(mMockedResources); }