use of org.robolectric.shadows.testing.TestContentProvider1 in project robolectric by robolectric.
the class ContentProviderControllerTest method create_shouldCallOnCreate.
@Test
public void create_shouldCallOnCreate() throws Exception {
TestContentProvider1 myContentProvider = controller.create().get();
assertThat(myContentProvider.transcript).containsExactly("onCreate");
}
use of org.robolectric.shadows.testing.TestContentProvider1 in project robolectric by robolectric.
the class ContentProviderControllerTest method shouldInitializeFromManifestProviderInfo.
@Test
public void shouldInitializeFromManifestProviderInfo() throws Exception {
TestContentProvider1 myContentProvider = controller.create().get();
assertThat(myContentProvider.getReadPermission()).isEqualTo("READ_PERMISSION");
assertThat(myContentProvider.getWritePermission()).isEqualTo("WRITE_PERMISSION");
assertThat(myContentProvider.getPathPermissions()).hasLength(1);
PathPermission pathPermission = myContentProvider.getPathPermissions()[0];
assertThat(pathPermission.getPath()).isEqualTo("/path/*");
assertThat(pathPermission.getType()).isEqualTo(PathPermission.PATTERN_SIMPLE_GLOB);
assertThat(pathPermission.getReadPermission()).isEqualTo("PATH_READ_PERMISSION");
assertThat(pathPermission.getWritePermission()).isEqualTo("PATH_WRITE_PERMISSION");
}
use of org.robolectric.shadows.testing.TestContentProvider1 in project robolectric by robolectric.
the class ShadowContentProviderTest method testSetCallingPackage.
@Config(minSdk = KITKAT)
@Test
public void testSetCallingPackage() {
ContentProvider provider = new TestContentProvider1();
shadowOf(provider).setCallingPackage("calling-package");
assertThat(provider.getCallingPackage()).isEqualTo("calling-package");
}
use of org.robolectric.shadows.testing.TestContentProvider1 in project robolectric by robolectric.
the class ContentProviderControllerTest method whenNoProviderManifestEntryFound_shouldStillInitialize.
@Test
public void whenNoProviderManifestEntryFound_shouldStillInitialize() throws Exception {
TestContentProvider1 myContentProvider = Robolectric.buildContentProvider(NotInManifestContentProvider.class).create().get();
assertThat(myContentProvider.getReadPermission()).isNull();
assertThat(myContentProvider.getWritePermission()).isNull();
assertThat(myContentProvider.getPathPermissions()).isNull();
}
use of org.robolectric.shadows.testing.TestContentProvider1 in project robolectric by robolectric.
the class ContentProviderControllerTest method shutdown_shouldCallShutdown.
@Test
public void shutdown_shouldCallShutdown() throws Exception {
TestContentProvider1 myContentProvider = controller.shutdown().get();
assertThat(myContentProvider.transcript).containsExactly("shutdown");
}
Aggregations