LoginServiceImpl extends BaseRetrofitService<LoginRepository> implements org.unicef.rapidreg.service
        .LoginService { @Override public boolean isPasswordValid(String password) { return password != null && password.matches("\\A(?=.*[a-zA-Z])(?=.*[0-9]).{8,}\\z"); } LoginServiceImpl(ConnectivityManager connectivityManager,
                            TelephonyManager telephonyManager,
                            UserDao userDao); @Override boolean isOnline(); @Override void loginOnline(final String username,
                            final String password,
                            final String url,
                            String imei,
                            final LoginCallback callback); @Override void loginOffline(String username, String password, String url, LoginCallback callback); @Override void destroy(); @Override String loadLastLoginServerUrl(); @Override boolean isUsernameValid(String username); @Override boolean isPasswordValid(String password); @Override boolean isUrlValid(String url);  }
@Test public void should_return_false_when_password_is_empty() { assertThat(loginService.isPasswordValid(null), CoreMatchers.is(false)); assertThat(loginService.isPasswordValid(""), CoreMatchers.is(false)); }
@Test public void should_verify_whether_password_is_valid() throws Exception { boolean actual = loginService.isPasswordValid("ab12c34*"); assertThat("Should return password is true", actual, is(true)); }
@Test public void should_return_false_when_password_is_invalid() throws Exception { assertThat("Should return password is false", loginService.isPasswordValid("123"), is(false)); }