@Test
public void testAuthenticationPositive() throws Exception {

    HttpServletRequest req = prepareRequest();
    JaasAuthenticator auth = new JaasAuthenticator("jolokia") {
        @Override
        protected LoginContext createLoginContext(String realm, CallbackHandler handler) throws LoginException {
            LoginContext mockLogin = mock(LoginContext.class);
            mockLogin.login();
            expect(mockLogin.getSubject()).andReturn(SUBJECT);
            replay(mockLogin);
            return mockLogin;
        }
    };
    assertTrue(auth.doAuthenticate(req, info));
}