Search in sources :

Example 1 with DefaultTestLifecycle

use of org.robolectric.DefaultTestLifecycle in project robolectric by robolectric.

the class ShadowContentResolverTest method getProvider_shouldNotReturnAnyProviderWhenManifestIsNull.

@Test
public void getProvider_shouldNotReturnAnyProviderWhenManifestIsNull() {
    Application application = new DefaultTestLifecycle().createApplication(null, null, null);
    ReflectionHelpers.callInstanceMethod(application, "attach", ReflectionHelpers.ClassParameter.from(Context.class, RuntimeEnvironment.application.getBaseContext()));
    assertThat(ShadowContentResolver.getProvider(Uri.parse("content://"))).isNull();
}
Also used : Context(android.content.Context) DefaultTestLifecycle(org.robolectric.DefaultTestLifecycle) Application(android.app.Application) Test(org.junit.Test)

Example 2 with DefaultTestLifecycle

use of org.robolectric.DefaultTestLifecycle in project robolectric by robolectric.

the class ParallelUniverseTest method setUpApplicationState.

private void setUpApplicationState(Config defaultConfig) {
    ResourceTable sdkResourceProvider = ResourceTableFactory.newFrameworkResourceTable(new ResourcePath(android.R.class, null, null));
    final RoutingResourceTable routingResourceTable = new RoutingResourceTable(ResourceTableFactory.newResourceTable("org.robolectric", new ResourcePath(R.class, null, null)));
    pu.setUpApplicationState(null, new DefaultTestLifecycle(), new AndroidManifest(null, null, null, "package"), defaultConfig, sdkResourceProvider, routingResourceTable, RuntimeEnvironment.getSystemResourceTable());
}
Also used : R(org.robolectric.R) DefaultTestLifecycle(org.robolectric.DefaultTestLifecycle) AndroidManifest(org.robolectric.manifest.AndroidManifest)

Aggregations

DefaultTestLifecycle (org.robolectric.DefaultTestLifecycle)2 Application (android.app.Application)1 Context (android.content.Context)1 Test (org.junit.Test)1 R (org.robolectric.R)1 AndroidManifest (org.robolectric.manifest.AndroidManifest)1