FragmentManager { public FragmentBuilder getFragmentBuilder() { FragmentBuilder builder = builders.get(); if (builder == null) { if (log.isLoggable(Level.FINEST)) { log.finest("Creating new FragmentBuilder"); } builder = new FragmentBuilder(); builders.set(builder); int currentCount = threadCounter.incrementAndGet(); int builderCount = builder.incrementThreadCount(); if (log.isLoggable(Level.FINEST)) { log.finest("Associate Thread with FragmentBuilder(1): Total Thread Count = " + currentCount + " : Fragment Thread Count = " + builderCount); synchronized (threadNames) { threadNames.add(Thread.currentThread().getName()); } } } return builder; }  boolean hasFragmentBuilder(); FragmentBuilder getFragmentBuilder(); void setFragmentBuilder(FragmentBuilder builder); void clear(); void diagnostics();  }
@Test public void testGetSameBuilder() { FragmentManager manager = new FragmentManager(); FragmentBuilder builder1 = manager.getFragmentBuilder(); FragmentBuilder builder2 = manager.getFragmentBuilder(); assertEquals("Should be same builder", builder1, builder2); }