Class LoginServiceNGTest

java.lang.Object
jmockit.loginExample.domain.userLogin.LoginServiceNGTest

public final class LoginServiceNGTest extends Object
A small TestNG test suite for a single class (LoginService), based on this article.
  • Constructor Details

    • LoginServiceNGTest

      public LoginServiceNGTest()
  • Method Details

    • setAccountToLoggedInWhenPasswordMatches

      public void setAccountToLoggedInWhenPasswordMatches() throws Exception
      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

      public void setAccountToRevokedAfterThreeFailedLoginAttempts() throws Exception
      Sets the account to revoked after three failed login attempts.
      Throws:
      Exception - the exception
    • notSetAccountLoggedInIfPasswordDoesNotMatch

      public void notSetAccountLoggedInIfPasswordDoesNotMatch() throws Exception
      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

      public void notRevokeSecondAccountAfterTwoFailedAttemptsOnFirstAccount() throws Exception
      Not revoke second account after two failed attempts on first account.
      Throws:
      Exception - the exception
    • 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

      public void resetBackToInitialStateAfterSuccessfulLogin() throws Exception
      Reset back to initial state after successful login.
      Throws:
      Exception - the exception