【发布时间】:2014-05-05 22:26:17
【问题描述】:
我是 Java 和 Android 的新手。在下面的 sn-p 中,当用户名和密码不正确时,我会显示一条错误消息。现在我需要在 2 次错误尝试后在错误消息中添加一些额外信息。 如果我需要设置一个计数器来识别尝试? 我该怎么做?
public void testBadCredentials() throws Exception {
RestClientFactoryTest.setPrefixAllInstances("login-failure");
XMLRPCFactoryTest.setPrefixAllInstances("login-failure");
mSolo.enterText(0, "test"); //username
mSolo.enterText(1, "test"); //password
mSolo.clickOnText(mSolo.getString(R.string.sign_in));
boolean errorMessageFound = mSolo.searchText(mSolo.getString(R.string.username_or_password_incorrect));
assertTrue("Error message not found", errorMessageFound);
}
【问题讨论】:
标签: java android if-statement conditional-statements