-1
私はMyFragmentをテストするためにEspressoでテストを書いています。 OK。エスプレッソからの呼び出しはどのようにフラグメントカスタムメソッドですか?
カスタムメソッドcustomUpdateを呼び出す必要があり試験方法への書き込み()MyFragmentで:フラグメント(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());
}
カスタム方法。
private void customUpdate() {
cursor = MyService.getCursor(context, someFilter, true);
contactAdapter.changeCursor(cursor);
}
どうすればいいですか?