ActionBarFragment extends BaseFragment { protected final boolean isActionBarAvailable() { return actionBarDelegate != null; }  @Override void onCreate(@Nullable final Bundle savedInstanceState); @Override void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater); @Override void onActivityCreated(@Nullable final Bundle savedInstanceState); void invalidateActionBar();  }
@Test public void testIsActionBarAvailable() { final ActionBarFragment fragment = new TestFragment(); fragment.actionBarDelegate = mock(ActionBarDelegate.class); assertThat(fragment.isActionBarAvailable(), is(true)); }
@Test public void testIsActionBarAvailableWhenNotAttached() { final TestFragment fragment = new TestFragment(); assertThat(fragment.isActionBarAvailable(), is(false)); }