Skip to content

Instantly share code, notes, and snippets.

@Adrianvdh
Last active January 11, 2018 04:54
Show Gist options
  • Save Adrianvdh/aac93ea148d7e1fbc9eaae26ba6d6543 to your computer and use it in GitHub Desktop.
Save Adrianvdh/aac93ea148d7e1fbc9eaae26ba6d6543 to your computer and use it in GitHub Desktop.
@Test
public void userLoginWithCorrectCredentials() throws Exception {
// Given that this user exists
String username = "adrianvdh";
String password = "hello123";
AuthorisationContext authorisationContext = new AuthorisationContext();
// When authenticating
authorisationContext.authenticate(username, password);
// Then the session must be valid
Session userSession = Session.getCurrentSession();
Assert.assertEquals("adrianvdh", userSession.getAuthenticatedUser().username);
Assert.assertEquals("hello123", userSession.getAuthenticatedUser().password);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment