### Question:
HttpRequestBuilder { public static TokenExchange newTokenRequest() { return new TokenExchange().requestType(TOKEN_EXCHANGE); }  static Authorized newAuthorizedRequest(); static Configuration newConfigurationRequest(); static TokenExchange newTokenRequest(); static RevokeToken newRevokeTokenRequest(); static Profile newProfileRequest(); static RefreshToken newRefreshTokenRequest(); static Introspect newIntrospectRequest();  }### Answer:
@Test public void createInvalidTokenExchangeRequest() throws AuthorizationException { mExpectedEx.expect(AuthorizationException.class); mExpectedEx.expectMessage("Missing service configuration"); HttpRequestBuilder.newTokenRequest() .config(mConfig) .createRequest(); }
@Test public void createInvalidTokenExchangeRequestNoAuth() throws AuthorizationException { mExpectedEx.expect(AuthorizationException.class); mExpectedEx.expectMessage("Missing auth request or response"); HttpRequestBuilder.newTokenRequest() .providerConfiguration(mConfiguration) .config(mConfig) .createRequest(); }
@Test public void createTokenExchangeRequest() throws AuthorizationException { TokenRequest request = HttpRequestBuilder.newTokenRequest() .providerConfiguration(mConfiguration) .authRequest(getAuthorizeRequest(mConfig, CodeVerifierUtil.generateRandomCodeVerifier())) .authResponse(getAuthorizeResponse(CUSTOM_STATE, CUSTOM_CODE)) .config(mConfig) .createRequest(); assertNotNull(request); assertTrue(request.toString().contains(RequestType.TOKEN_EXCHANGE.toString())); }
@Test public void authRequest() throws AuthorizationException { HttpRequestBuilder.TokenExchange builder = HttpRequestBuilder.newTokenRequest() .authRequest(TestValues.getAuthorizeRequest(mConfig, CodeVerifierUtil.generateRandomCodeVerifier())); assertNotNull(builder.mAuthRequest); }
@Test public void authResponse() { HttpRequestBuilder.TokenExchange builder = HttpRequestBuilder.newTokenRequest() .authResponse(TestValues.getAuthorizeResponse(CUSTOM_STATE, CUSTOM_CODE)); assertNotNull(builder.mAuthResponse); }