I have the following function I want to test :
public void attemptLogin() {
        // Store values at the time of the login attempt.
        String userid = mUserIdView.getText().toString();
        if (TextUtils.isEmpty(userid)) {
            if (mCurrentUser != null) {
                userid = mCurrentUser.getUserId();
            }
        }
}
I want to write a unit test and give the function above an input for the userId. As can be seen, the function is doing :
mUserIdView.getText().toString();
And causes the code to fail because the UI is not loaded (We have UI testing for that) How would you recommend to test it ? Thanks !
 
     
    