WebFragment extends ActionBarFragment { protected void notifyLoadingFinished(@NonNull final String webUrl) { if (contentLoadingListener != null) contentLoadingListener.onLoadingFinished(webUrl); }  static boolean isValidWebUrl(@Nullable final String url); @NonNull static WebFragment newInstance(); @NonNull static WebFragment newInstance(@NonNull final WebOptions options); @Override void onCreate(@Nullable final Bundle savedInstanceState); @NonNull final WebOptions getOptions(); void setOnWebContentLoadingListener(@Nullable final OnWebContentLoadingListener listener); @Override View onCreateView(@NonNull final LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable final Bundle savedInstanceState); @Nullable WebView getWebView(); @Override void onActivityCreated(@Nullable final Bundle savedInstanceState); boolean loadContent(@Nullable final String content); @Nullable String getContent(); @ContentType int getContentType(); @Override void onSaveInstanceState(@NonNull final Bundle state); @Override void onDestroyView();  }
@Test public void testNotifyLoadingFinished() { final WebFragment.OnWebContentLoadingListener mockListener = mock(WebFragment.OnWebContentLoadingListener.class); final WebFragment fragment = new WebFragment(); fragment.setOnWebContentLoadingListener(mockListener); fragment.notifyLoadingFinished("test_url"); verify(mockListener).onLoadingFinished("test_url"); verifyNoMoreInteractions(mockListener); }
@Test public void testNotifyLoadingFinishedWithoutRegisteredListener() { final WebFragment fragment = new WebFragment(); fragment.notifyLoadingFinished("test_url"); }