示例#1
0
  @Test
  public void testTellAFriend() {
    openDrawer(R.id.drawer_layout);
    Intents.intending(
            AllOf.allOf(
                hasAction(Intent.ACTION_CHOOSER),
                hasExtra(Intent.EXTRA_TITLE, mActivity.getString(R.string.share_via))))
        .respondWith(new Instrumentation.ActivityResult(Activity.RESULT_OK, null));

    onView(
            allOf(
                is(instanceOf(NavigationMenuItemView.class)),
                withText(R.string.action_tellafriend)))
        .perform(click());
    intended(
        allOf(
            hasAction(Intent.ACTION_CHOOSER),
            hasExtra(Intent.EXTRA_TITLE, mActivity.getString(R.string.share_via))));
  }
 @After
 public void After() {
   Intents.release();
 }
 @Before
 public void before() {
   Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
   ctx = instrumentation.getTargetContext();
   Intents.init();
 }
 @After
 public void tearDown() {
   Intents.release();
 }
 @Before
 public void setUp() {
   Intents.init();
 }