I write test in Espresso to test MyFragment. OK.
A write to test method that need to call custom method customUpdate() in MyFragment:
@Rule
    public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, true, false);
 @Before
    public void init() {
        mActivityRule.launchActivity(intent);
        // Here forward to MyFragment
        onView(withId(R.id.myTextView)).perform(click());
    }
     @Test
     public void searchAddFavorite() {
       // update column in db 
       MyService.updateColumn(context, 123, Profile.MY_COLUMN_NAME, false);
       // here need to call fragment custom method customUpdate()  
      onView(withId(R.id.searchView)).perform(click());
    }
Custom method in fragment (MyFragment) change cursor.
private void customUpdate() {
    cursor = MyService.getCursor(context, someFilter, true);
    contactAdapter.changeCursor(cursor);
}
How I can do this?
 
     
    