BaseFragmentFactory implements FragmentFactory { @NonNull protected FragmentFactoryAnnotationHandler getAnnotationHandler() { FragmentAnnotations.checkIfEnabledOrThrow(); return annotationHandler; } BaseFragmentFactory(); @Nullable static String createFragmentTag(@NonNull final Class<?> classOfFactory, @NonNull final String fragmentName); @Override boolean isFragmentProvided(final int fragmentId); @Override @Nullable Fragment createFragment(final int fragmentId); @Override @Nullable String createFragmentTag(final int fragmentId);  }
@Test public void testGetAnnotationHandler() { final BaseFragmentFactory factory = new TestFactory(); final FragmentFactoryAnnotationHandler annotationHandler = factory.getAnnotationHandler(); assertThat(annotationHandler, is(notNullValue())); assertThat(annotationHandler, is(factory.getAnnotationHandler())); }
@Test(expected = IllegalStateException.class) public void testGetAnnotationHandlerWhenAnnotationsAreDisabled() { FragmentAnnotations.setEnabled(false); final TestFactory factory = new TestFactory(); factory.getAnnotationHandler(); }