### Question:
AuthorizationFlowHandler { public TokenProvider authorize(String username, String password) { try { Authorization authorization = authorizationApiHandler.initializeAuth( this.config.getClientId(), this.config.getRedirectUri(), this.config.getScopes() ); this.retrieveConsent(authorization, username, password); this.submitUserConsent(authorization); return createTokenProvider(authorization); } catch(RuntimeException | SessionRetrievalException | UserLoginFailedException | UserConsentException e) { throw new AuthorizationInitializationException("Initialization flow failed can't instantiate a valid token provider", e); } } AuthorizationFlowHandler(OAuthConfig config, TokenRepository tokenRepository, WebFormHandler webFormHandler, AuthorizationApiHandler authorizationApiHandler); static AuthorizationFlowHandler setup(OAuthConfig config, TokenRepository tokenRepository); static AuthorizationFlowHandler setup(OAuthConfig config); static TokenProvider fromRepository(OAuthConfig config, TokenRepository tokenRepository); TokenProvider authorize(String username, String password);  }### Answer:
@Test(expected = AuthorizationInitializationException.class) public void testAuthorize_whenAnyRequiredStepFails_shouldThrowException() throws Exception { Mockito.when(authorizationApiHandler.initializeAuth(anyString(), anyString(), anyString())).thenThrow(new SessionRetrievalException("bla", null)); authorizationFlowHandler.authorize("username", "password"); }