org.robolectric.internal.ShadowExtractor Java Examples

The following examples show how to use org.robolectric.internal.ShadowExtractor. 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: ShareModuleTest.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Test
public void testShareDialog() {
  final String title = "Title";
  final String message = "Message";
  final String dialogTitle = "Dialog Title";

  JavaOnlyMap content = new JavaOnlyMap();
  content.putString("title", title);
  content.putString("message", message);

  final SimplePromise promise = new SimplePromise();

  mShareModule.share(content, dialogTitle, promise);

  final Intent chooserIntent = 
    ((ShadowApplication)ShadowExtractor.extract(RuntimeEnvironment.application)).getNextStartedActivity();
  assertNotNull("Dialog was not displayed", chooserIntent);
  assertEquals(Intent.ACTION_CHOOSER, chooserIntent.getAction());
  assertEquals(dialogTitle, chooserIntent.getExtras().get(Intent.EXTRA_TITLE));

  final Intent contentIntent = (Intent)chooserIntent.getExtras().get(Intent.EXTRA_INTENT);
  assertNotNull("Intent was not built correctly", contentIntent);
  assertEquals(Intent.ACTION_SEND, contentIntent.getAction());
  assertEquals(title, contentIntent.getExtras().get(Intent.EXTRA_SUBJECT));
  assertEquals(message, contentIntent.getExtras().get(Intent.EXTRA_TEXT));

  assertEquals(1, promise.getResolved());
}
 
Example #2
Source File: FileUtilsTest.java    From twitter-kit-android with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    final ShadowMimeTypeMap mimeTypeMap = (ShadowMimeTypeMap) ShadowExtractor
            .extract(MimeTypeMap.getSingleton());
    mimeTypeMap.addExtensionMimeTypMapping("jpg", "image/jpeg");
    mimeTypeMap.addExtensionMimeTypMapping("jpeg", "image/jpeg");
    mimeTypeMap.addExtensionMimeTypMapping("png", "image/png");
    this.mimeTypeMap = mimeTypeMap;
}
 
Example #3
Source File: ShadowSnackbar.java    From fyber_mobile_offers with MIT License 4 votes vote down vote up
static ShadowSnackbar shadowOf(Snackbar bar) {
    return (ShadowSnackbar) ShadowExtractor.extract(bar);
}
 
Example #4
Source File: AbstractGridItemViewAssert.java    From materialandroid with Apache License 2.0 4 votes vote down vote up
private static ShadowDrawable shadowOf(Drawable actual) {
  return (ShadowDrawable) ShadowExtractor.extract(actual);
}
 
Example #5
Source File: AbstractListItemViewAssert.java    From materialandroid with Apache License 2.0 4 votes vote down vote up
private static ShadowDrawable shadowOf(Drawable actual) {
  return (ShadowDrawable) ShadowExtractor.extract(actual);
}
 
Example #6
Source File: AbstractPasswordEditTextAssert.java    From materialandroid with Apache License 2.0 4 votes vote down vote up
public static ShadowDrawable shadowOf(Drawable actual) {
  return (ShadowDrawable) ShadowExtractor.extract(actual);
}