public void valid_login() {
   Authentication auth =
       provider.authenticate(new UsernamePasswordAuthenticationToken("scott", "tiger"));
   assertNotNull(auth);
   UserDetails principal = (UserDetails) auth.getPrincipal();
   assertEquals(principal.getClass(), SessionContext.class);
   assertEquals(principal.getUsername(), "scott");
 }
 @Test(expectedExceptions = BadCredentialsException.class)
 public void invalid_login() {
   provider.authenticate(new UsernamePasswordAuthenticationToken("scott", "lion"));
 }