PopUpCoachMarkPresenter { protected void setTypeFaceForCoachMarkText(@Nullable String fontFileForPopUpText) { if (StringUtils.isNotNullOrEmpty(fontFileForPopUpText)) { Typeface typeface = mTypeFaceProvider.getTypeFaceFromAssets(fontFileForPopUpText); if (typeface != null) { mPresentation.setTypeFaceForPopUpText(typeface); } } } PopUpCoachMarkPresenter(final IStringResourceProvider stringResourceProvider,
                                   final IDimensionResourceProvider dimensionResourceProvider,
                                   final ITypeFaceProvider typeFaceProvider,
                                   final IScreenInfoProvider screenInfoProvider); void onCreate(CoachMarkBuilder coachMarkBuilder); void onCreateView(IPopUpCoachMarkPresentation popUpCoachMarkPresentation); void onViewCreated(); void onDestroyView(); void onDestroy(); void onOkButtonClicked(); void onShimClicked();  }
@Test public void setTypeFaceForCoachMarkTextNullFontFileTest() { mPopUpCoachMarkPresenter.setTypeFaceForCoachMarkText(null); Mockito.verify(mTypeFaceProvider, Mockito.times(0)).getTypeFaceFromAssets(Matchers.anyString()); Mockito.verify(mPopUpCoachMarkPresentation, Mockito.times(0)) .setTypeFaceForPopUpText((Typeface) Matchers.anyObject()); }
@Test public void setTypeFaceForCoachMarkTextNullTypefaceTest() { Mockito.when(mTypeFaceProvider.getTypeFaceFromAssets(Matchers.anyString())).thenReturn(null); mPopUpCoachMarkPresenter.setTypeFaceForCoachMarkText("fontFilePath"); Mockito.verify(mTypeFaceProvider, Mockito.times(1)).getTypeFaceFromAssets("fontFilePath"); Mockito.verify(mPopUpCoachMarkPresentation, Mockito.times(0)) .setTypeFaceForPopUpText((Typeface) Matchers.anyObject()); Mockito.verifyNoMoreInteractions(mPopUpCoachMarkPresentation); }
@Test public void setTypeFaceForCoachMarkTextTest() { Typeface typeface = Mockito.mock(Typeface.class); Mockito.when(mTypeFaceProvider.getTypeFaceFromAssets(Matchers.anyString())).thenReturn(typeface); mPopUpCoachMarkPresenter.setTypeFaceForCoachMarkText("fontFilePath"); Mockito.verify(mTypeFaceProvider, Mockito.times(1)).getTypeFaceFromAssets(Matchers.anyString()); Mockito.verify(mPopUpCoachMarkPresentation, Mockito.times(1)) .setTypeFaceForPopUpText(typeface); Mockito.verifyNoMoreInteractions(mPopUpCoachMarkPresentation); }