### Question:
TokenAuthRealm extends AuthorizingRealm { @Override protected AuthenticationInfo doGetAuthenticationInfo( final AuthenticationToken authenticationToken) throws AuthenticationException { final String username; final String password; final String domain; try { final String possiblyQualifiedUser = TokenUtils.extractUsername(authenticationToken); username = HeaderUtils.extractUsername(possiblyQualifiedUser); domain = HeaderUtils.extractDomain(possiblyQualifiedUser); password = TokenUtils.extractPassword(authenticationToken); } catch (NullPointerException e) { throw new AuthenticationException(FATAL_ERROR_DECODING_CREDENTIALS, e); } catch (ClassCastException e) { throw new AuthenticationException(FATAL_ERROR_BASIC_AUTH_ONLY, e); } if (!Strings.isNullOrEmpty(password)) { Map<String, List<String>> headers = HeaderUtils.formHeaders(username, password, domain); for (TokenAuth ta : tokenAuthenticators.getTokenAuthCollection()) { try { LOG.debug("Authentication attempt using {}", ta.getClass().getName()); final Authentication auth = ta.validate(headers); if (auth != null) { LOG.debug("Authentication attempt successful"); authenticationService.set(auth); final ODLPrincipal odlPrincipal = ODLPrincipalImpl.createODLPrincipal(auth); return new SimpleAuthenticationInfo(odlPrincipal, password.toCharArray(), getName()); } } catch (AuthenticationException ae) { LOG.debug("Authentication attempt unsuccessful"); throw new AuthenticationException(UNABLE_TO_AUTHENTICATE, ae); } } } final String token = TokenUtils.extractUsername(authenticationToken); try { final Authentication auth = validate(token); final ODLPrincipal odlPrincipal = ODLPrincipalImpl.createODLPrincipal(auth); return new SimpleAuthenticationInfo(odlPrincipal, "", getName()); } catch (AuthenticationException e) { LOG.debug("Unknown OAuth2 Token Access Request", e); } LOG.debug("Authentication failed: exhausted TokenAuth resources"); return null; } TokenAuthRealm();   }### Answer:
@Test(expected = org.apache.shiro.authc.AuthenticationException.class) public void testDoGetAuthenticationInfoAuthenticationToken() { testRealm.doGetAuthenticationInfo(null); }