use of org.robolectric.annotation.Config in project android-oss by kickstarter.
the class DateTimeUtilsTest method testRelative_withLocale.
@Test
@Config(qualifiers = "de")
public void testRelative_withLocale() {
final Context context = context();
final KSString ksString = ksString();
final DateTime dateTime = DateTime.parse("2015-12-17T18:35:05Z");
final RelativeDateTimeOptions.Builder builder = RelativeDateTimeOptions.builder();
assertEquals("vor 2 Minuten", DateTimeUtils.relative(context, ksString, dateTime, builder.relativeToDateTime(DateTime.parse("2015-12-17T18:37:05Z")).build()));
assertEquals("in 2 Minuten", DateTimeUtils.relative(context, ksString, dateTime, builder.relativeToDateTime(DateTime.parse("2015-12-17T18:33:05Z")).build()));
}
use of org.robolectric.annotation.Config in project materialistic by hidroh.
the class UserActivityTest method testScrollToTop.
@Config(shadows = ShadowRecyclerView.class)
@Test
public void testScrollToTop() {
verify(userManager).getUser(eq("username"), userCaptor.capture());
userCaptor.getValue().onResponse(user);
RecyclerView recyclerView = (RecyclerView) activity.findViewById(R.id.recycler_view);
recyclerView.smoothScrollToPosition(1);
assertThat(customShadowOf(recyclerView).getScrollPosition()).isEqualTo(1);
TabLayout.Tab tab = ((TabLayout) activity.findViewById(R.id.tab_layout)).getTabAt(0);
tab.select();
tab.select();
assertThat(customShadowOf(recyclerView).getScrollPosition()).isEqualTo(0);
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ResourceLoaderTest method testChoosesLayoutBasedOnSearchPath_respectsOrderOfPath.
@Test
@Config(qualifiers = "doesnotexist-land-xlarge")
public void testChoosesLayoutBasedOnSearchPath_respectsOrderOfPath() throws Exception {
View view = LayoutInflater.from(RuntimeEnvironment.application).inflate(R.layout.different_screen_sizes, null);
TextView textView = (TextView) view.findViewById(android.R.id.text1);
assertThat(textView.getText().toString()).isEqualTo("land");
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ContentProviderControllerTest method shouldRegisterWithContentResolver.
@Test
@Config(manifest = "src/test/resources/TestAndroidManifestWithContentProviders.xml")
public void shouldRegisterWithContentResolver() throws Exception {
controller.create().get();
ContentResolver contentResolver = RuntimeEnvironment.application.getContentResolver();
ContentProviderClient client = contentResolver.acquireContentProviderClient("org.robolectric.authority2");
client.query(Uri.parse("something"), new String[] { "title" }, "*", new String[] {}, "created");
assertThat(controller.get().transcript).containsExactly("onCreate", "query for something");
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ContentProviderControllerTest method shouldInitializeFromManifestProviderInfo.
@Test
@Config(manifest = "src/test/resources/TestAndroidManifestWithContentProviders.xml")
public void shouldInitializeFromManifestProviderInfo() throws Exception {
MyContentProvider myContentProvider = controller.create().get();
assertThat(myContentProvider.getReadPermission()).isEqualTo("READ_PERMISSION");
assertThat(myContentProvider.getWritePermission()).isEqualTo("WRITE_PERMISSION");
assertThat(myContentProvider.getPathPermissions()).hasSize(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");
}
Aggregations