use of org.robolectric.shadows.ShadowIntent in project collect by opendatakit.
the class MainActivityTest method sendDataButtonTest.
/**
* {@link Test} to assert sendDataButton's functioning.
*/
@Test
public void sendDataButtonTest() throws Exception {
Button sendDataButton = mainMenuActivity.findViewById(R.id.send_data);
assertNotNull(sendDataButton);
assertEquals(View.VISIBLE, sendDataButton.getVisibility());
assertEquals(mainMenuActivity.getString(R.string.send_data_button), sendDataButton.getText());
sendDataButton.performClick();
ShadowActivity shadowActivity = shadowOf(mainMenuActivity);
Intent startedIntent = shadowActivity.getNextStartedActivity();
ShadowIntent shadowIntent = shadowOf(startedIntent);
assertEquals(InstanceUploaderList.class.getName(), shadowIntent.getIntentClass().getName());
}
use of org.robolectric.shadows.ShadowIntent in project collect by opendatakit.
the class MainActivityTest method dataButtonTest.
/**
* {@link Test} to assert dataButton's functioning.
*/
@Test
public void dataButtonTest() throws Exception {
Button dataButton = mainMenuActivity.findViewById(R.id.enter_data);
assertNotNull(dataButton);
assertEquals(View.VISIBLE, dataButton.getVisibility());
assertEquals(mainMenuActivity.getString(R.string.enter_data_button), dataButton.getText());
dataButton.performClick();
ShadowActivity shadowActivity = shadowOf(mainMenuActivity);
Intent startedIntent = shadowActivity.getNextStartedActivity();
ShadowIntent shadowIntent = shadowOf(startedIntent);
assertEquals(FormChooserList.class.getName(), shadowIntent.getIntentClass().getName());
}
use of org.robolectric.shadows.ShadowIntent in project scdl by passy.
the class ShareIntentResolverTest method testResolveSoundcloudDataUrlToId.
@Test
public void testResolveSoundcloudDataUrlToId() throws ShareIntentResolverException {
ShadowIntent intent = Robolectric.shadowOf(mIntent);
intent.setData(Uri.parse("soundcloud://tracks/76738498"));
final ShareIntentResolver resolver = TestHelper.getInjector().getInstance(ShareIntentResolver.class);
final PendingDownload result = resolver.resolvePendingDownload();
assertThat(result.getId(), equalTo("76738498"));
assertThat(result.getType(), equalTo(MediaDownloadType.TRACK));
}
use of org.robolectric.shadows.ShadowIntent in project scdl by passy.
the class ShareIntentResolverTest method testResolveToId.
@Test
public void testResolveToId() throws ShareIntentResolverException {
ShadowIntent intent = Robolectric.shadowOf(mIntent);
intent.setData(Uri.parse("https://soundcloud.com/dj-newklear/newklear-contaminated-2"));
final ShareIntentResolver resolver = TestHelper.getInjector().getInstance(ShareIntentResolver.class);
final PendingDownload result = resolver.resolvePendingDownload();
assertThat(result.getId(), equalTo("44276907"));
assertThat(result.getType(), equalTo(MediaDownloadType.TRACK));
}
use of org.robolectric.shadows.ShadowIntent in project scdl by passy.
the class ShareIntentResolverTest method testNoSslResolveToId.
@Test
public void testNoSslResolveToId() throws ShareIntentResolverException {
ShadowIntent intent = Robolectric.shadowOf(mIntent);
intent.setData(Uri.parse("http://soundcloud.com/dj-newklear/newklear-contaminated-2"));
final ShareIntentResolver resolver = TestHelper.getInjector().getInstance(ShareIntentResolver.class);
final PendingDownload result = resolver.resolvePendingDownload();
assertThat(result.getId(), equalTo("44276907"));
assertThat(result.getType(), equalTo(MediaDownloadType.TRACK));
}
Aggregations