BaseFragmentFactory implements FragmentFactory { @Nullable protected String onCreateFragmentTag(final int fragmentId) { return items.indexOfKey(fragmentId) >= 0 ? items.get(fragmentId).tag : createFragmentTag(getClass(), Integer.toString(fragmentId)); } 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);  }
@SuppressWarnings("ConstantConditions") @Test public void testOnCreateFragmentTag() { final BaseFragmentFactory factory = new TestFactory(); assertThat( factory.onCreateFragmentTag(TestFactory.FRAGMENT_NOT_PROVIDED), is(BaseFragmentFactory.createFragmentTag(TestFactory.class, Integer.toString(TestFactory.FRAGMENT_NOT_PROVIDED))) ); for (final int providedFragmentId : TestFactory.providedFragmentIds) { assertThat( factory.onCreateFragmentTag(providedFragmentId), is(factory.getAnnotationHandler().getFragmentItems().get(providedFragmentId).tag) ); } }