SearchUserViewModel extends BaseObservable { public boolean onSearchAction(TextView view, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { loadUsers(); return true; } return false; } @Inject  SearchUserViewModel(@Named("searchUser") UseCase searchUserUseCase); void setFragmentListener(FragmentListener fragmentListener); TextWatcher getUsernameTextWatcher(); boolean onSearchAction(TextView view, int actionId, KeyEvent event); void onClickSearch(View view); void destroy(Boolean unsubsricbe); void setUsername(String username); ObservableInt getProgressVisibility(); ObservableInt getUserListVisibility(); final ObservableInt progressVisibility; final ObservableInt userListVisibility; }
@Test public void onSearchActionShouldDisplayMessageWhenNoUsernameInput() { searchUserViewModel.onSearchAction(textView, EditorInfo.IME_ACTION_SEARCH, null); verify(fragmentListener).showMessage("Enter a username"); }