### Question:
OidcHelper extends AbstractService { public String buildOauthRequestString(HttpServletRequest req) throws OAuthSystemException { OAuthClientRequest.AuthenticationRequestBuilder requestBuilder = OAuthClientRequest .authorizationLocation(this.oidcConfiguration.getOidcAuthLocation()) .setClientId(this.oidcConfiguration.getOidcClientId()) .setParameter("response_mode", "form_post") .setParameter("response_type", "code"); if (identityProviderExtractor.hasIdentityProvider(req)) { requestBuilder = requestBuilder.setParameter("kc_idp_hint", identityProviderExtractor.getIdentityProviderName(req)) .setRedirectURI(identityProviderExtractor.getRedirectUri(req)); } else if (StringUtils.isNotEmpty(this.oidcConfiguration.getDefaultIdentityProvider())) { requestBuilder = requestBuilder.setParameter("kc_idp_hint", this.oidcConfiguration.getDefaultIdentityProvider()) .setRedirectURI(identityProviderExtractor.getRedirectUri(req)); } else { requestBuilder = requestBuilder.setRedirectURI(buildRedirectURI(req)); } OAuthClientRequest oauthRequest = requestBuilder .buildQueryMessage(); return oauthRequest.getLocationUri(); }  String buildOauthRequestString(HttpServletRequest req); UserDetails getOidcUser(String accessToken); @Override void init(); boolean isOidcActive(); OAuthClientRequest buildOauthRequest(HttpServletRequest request, String code);  }### Answer:
@Test public void testBuildOauthRequestLocationUriWithIdentityProvider() throws Exception{ HttpServletRequest request = mock(HttpServletRequest.class); when(request.getRequestURL()).thenReturn(new StringBuffer("http: this.oidcConfiguration.setOidcClientId("test.client.id"); this.oidcConfiguration.setOidcAuthLocation("http: String clientRequest = oidcUserExtractor.buildOauthRequestString(request); assertThat(clientRequest,is(equalTo("http: }
@Test public void testBuildOauthRequestLocationUriWithDefaultIdentityProvider() throws Exception{ HttpServletRequest request = mock(HttpServletRequest.class); when(request.getRequestURL()).thenReturn(new StringBuffer("http: this.oidcConfiguration.setOidcClientId("test.client.id"); this.oidcConfiguration.setOidcAuthLocation("http: this.oidcConfiguration.setDefaultIdentityProvider("entando"); String clientRequest = oidcUserExtractor.buildOauthRequestString(request); assertThat(clientRequest,is(equalTo("http: }
@Test public void testBuildOauthRequestLocationUriWithNoIdentityProvider() throws Exception{ HttpServletRequest request = mock(HttpServletRequest.class); when(request.getRequestURL()).thenReturn(new StringBuffer("http: this.oidcConfiguration.setOidcClientId("test.client.id"); this.oidcConfiguration.setOidcAuthLocation("http: String clientRequest = oidcUserExtractor.buildOauthRequestString(request); assertThat(clientRequest,is(equalTo("http: }