Java Code Examples for androidx.fragment.app.testing.FragmentScenario#launchInContainer()

The following examples show how to use androidx.fragment.app.testing.FragmentScenario#launchInContainer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BuilderUnitTest.java    From MaterialTapTargetPrompt with Apache License 2.0 6 votes vote down vote up
@Test
public void testBuilder_Fragment()
{
    FragmentScenario<EmptyTestFragment> scenario = FragmentScenario.launchInContainer(EmptyTestFragment.class);
    scenario.onFragment(fragment -> {
        final MaterialTapTargetPrompt.Builder builder = new MaterialTapTargetPrompt.Builder(fragment);
        assertTrue(builder.getResourceFinder() instanceof SupportFragmentResourceFinder);
    });
}
 
Example 2
Source File: BuilderUnitTest.java    From MaterialTapTargetPrompt with Apache License 2.0 5 votes vote down vote up
@Test
public void testBuilder_Fragment_Resource()
{
    FragmentScenario<EmptyTestFragment> scenario = FragmentScenario.launchInContainer(EmptyTestFragment.class);
    scenario.onFragment(fragment -> {
        final MaterialTapTargetPrompt.Builder builder = new MaterialTapTargetPrompt.Builder(fragment, 0);
        assertTrue(builder.getResourceFinder() instanceof SupportFragmentResourceFinder);
    });
}
 
Example 3
Source File: BuilderUnitTest.java    From MaterialTapTargetPrompt with Apache License 2.0 5 votes vote down vote up
@Test
public void testBuilder_DialogFragment()
{
    FragmentScenario<EmptyTestDialogFragment> scenario = FragmentScenario.launchInContainer(EmptyTestDialogFragment.class);
    scenario.onFragment(fragment -> {
        final MaterialTapTargetPrompt.Builder builder = new MaterialTapTargetPrompt.Builder(fragment);
        assertTrue(builder.getResourceFinder() instanceof SupportFragmentResourceFinder);
    });
}
 
Example 4
Source File: SupportFragmentLoggerTest.java    From lightcycle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    controller = FragmentScenario.launchInContainer(SampleSupportFragment.class);
    controller.onFragment(fragment -> {
                supportFragmentLogger = ((SampleSupportFragment) fragment).supportFragmentLogger;
            }
    );
}