I have an application, the Authorization class in it, there is a method in the class:
private void login() { if (!RCP.NOT_LOGIN) return; String info = null; int worning = 0; String login = textLogin.getText().toString().trim(); String passHash = hash( hash(textPass.getText().toString(), "SHA-1"), "MD5"); info = DbWorker.setUser(login); // проверка успешности создания пользователя if (info == null) info = DbWorker.checkPass(passHash); else worning = R.string.aut_wrong_user_name; // проверка корректности ввода пароля if (info == null) info = DbWorker.checkActive(); else if (worning == 0) worning = R.string.aut_wrong_user_pass; // проверка легитимности пользователя if (info == null) info = DbWorker.logIn(); else if (worning == 0) worning = R.string.aut_wrong_user_activate; // проверка валидности пользователя if (info == null) info = DbWorker.setFIO(); else if (worning == 0) worning = R.string.aut_wrong_permission; // проверка наличия прав доступа if (info == null) if (port.isChecked()) { inten2(); } else { inten();} else if (worning == 0) worning = R.string.autho_error_reg_not_found; if (worning != 0) errorMes(worning).show(); // запись в журнале, при неудачной регистрации if (RCP.NOT_LOGIN) DbLog.writeEvent(DbLog.EV_USER_LOGIN_FAILURE, 3, info, 0, 0, 0, 0, 0); } I want to make a unit tests, so that every time after the next "rework" in hand, not to test this part. Unit tests, never wrote, but apparently that time has come.
Maybe one of you has already been in a similar situation and will advise where to start?
Ps read the drone documentation, and now read the "Android Application Testing Guide" from Diego Torres Milano. But I would like to find an example "on the fingers" in IDE ECLIPSE. Maybe someone does not mind the time, post a simple example, according to the above code (on the legitimacy of the entered data in the login and password fields))))