Class LoginServiceNGTest
java.lang.Object
jmockit.loginExample.domain.userLogin.LoginServiceNGTest
A small TestNG test suite for a single class (
LoginService), based on
this article.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDisallow concurrent logins.voidDisallow logging into revoked account.voidNot revoke second account after two failed attempts on first account.voidThis test is also redundant, as it exercises the same path as the previous one.voidReset back to initial state after successful login.voidThis test is redundant, as it exercises the same path as the last test.voidSets the account to revoked after three failed login attempts.voidThrow exception if account not found.
-
Constructor Details
-
LoginServiceNGTest
public LoginServiceNGTest()
-
-
Method Details
-
setAccountToLoggedInWhenPasswordMatches
This test is redundant, as it exercises the same path as the last test. It cannot simply be removed, because the last test does not perform the "account.setLoggedIn(true)" verification; if said verification is added there, however, then this test could be removed without weakening the test suite.- Throws:
Exception- the exception
-
setAccountToRevokedAfterThreeFailedLoginAttempts
-
notSetAccountLoggedInIfPasswordDoesNotMatch
This test is also redundant, as it exercises the same path as the previous one. Again, it cannot simply be removed since the previous test does not verify that "account.setLoggedIn(true)" is never called; if said verification is added there, however, this test could safely be removed.- Throws:
Exception- the exception
-
notRevokeSecondAccountAfterTwoFailedAttemptsOnFirstAccount
-
disallowConcurrentLogins
public void disallowConcurrentLogins()Disallow concurrent logins. -
throwExceptionIfAccountNotFound
public void throwExceptionIfAccountNotFound()Throw exception if account not found. -
disallowLoggingIntoRevokedAccount
public void disallowLoggingIntoRevokedAccount()Disallow logging into revoked account. -
resetBackToInitialStateAfterSuccessfulLogin
-