@Test
 public void shouldUseFragmentTransactionToAddFragmentToDummyActivityIfSubjectIsAnFragment() {
   when(testCase.getTestSubjectClassType()).thenReturn(RoboFragment.class);
   when(reflectionUtils.classIsOfAssignableForm(RoboFragment.class, RoboFragment.class))
       .thenReturn(true);
   when(reflectionUtils.createObjectProxy(RoboFragment.class, testFieldInjector))
       .thenReturn(fragment);
   when(reflectionUtils.objectIsOfAnyType(fragment, RoboFragment.class)).thenReturn(true);
   testFieldInjector.setupTestCase();
   TestFragmentManager fragmentManager =
       (TestFragmentManager)
           shadowOf((FragmentActivity) testFieldInjector.getCurrentContextForTest())
               .getSupportFragmentManager();
   assertThat(fragmentManager.getCommittedTransactions().size(), is(1));
   assertThat(
       (RoboFragment) fragmentManager.getCommittedTransactions().get(0).getFragment(),
       is(fragment));
 }
  @Test
  public void getCommittedTransactions_shouldReturnListOfOnlyCommittedTransactions()
      throws Exception {
    assertTrue(manager.getCommittedTransactions().isEmpty());

    FragmentTransaction transaction = manager.beginTransaction();
    assertTrue(manager.getCommittedTransactions().isEmpty());

    transaction.add(new Fragment(), "tag");
    transaction.commit();
    assertEquals(1, manager.getCommittedTransactions().size());
    assertSame(transaction, manager.getCommittedTransactions().get(0));

    FragmentTransaction anotherTransaction = manager.beginTransaction();
    anotherTransaction.add(new Fragment(), "tag");
    anotherTransaction.commit();
    assertEquals(2, manager.getCommittedTransactions().size());
    assertSame(anotherTransaction, manager.getCommittedTransactions().get(1));
  }