### Question:
SpardaOauth2Service implements Oauth2Service, PkceOauth2Extension { @Override public URI getAuthorizationRequestUri(Map<String, String> headers, Parameters parameters) throws IOException { requireValid(validateGetAuthorizationRequestUri(headers, parameters)); parameters.setAuthorizationEndpoint(authorizationEndpoint); parameters.setClientId(clientId); parameters.setScope(mapScope(parameters.getScope())); return UriBuilder.fromUri(oauth2Service.getAuthorizationRequestUri(headers, parameters)) .queryParam(Parameters.BIC, aspsp.getBic()) .build(); } private  SpardaOauth2Service(Aspsp aspsp,
                                Oauth2Service oauth2Service,
                                String clientId); static SpardaOauth2Service create(Aspsp aspsp,
                                             HttpClient httpClient,
                                             Pkcs12KeyStore keyStore,
                                             String clientId); @Override URI getAuthorizationRequestUri(Map<String, String> headers, Parameters parameters); @Override List<ValidationError> validateGetAuthorizationRequestUri(Map<String, String> headers, Parameters parameters); @Override TokenResponse getToken(Map<String, String> headers, Parameters parameters); @Override List<ValidationError> validateGetToken(Map<String, String> headers, Parameters parameters); @Override byte[] octetSequence();  }### Answer:
@Test void getAuthorizationRequestUri() throws IOException { Parameters parameters = new Parameters(); parameters.setRedirectUri(REDIRECT_URI); parameters.setScope(SCOPE); URI uri = oauth2Service.getAuthorizationRequestUri(Collections.emptyMap(), parameters); assertEquals(AUTH_HOST + "/oauth2/authorize" + "?response_type=code" + "&redirect_uri=" + URLEncoder.encode(REDIRECT_URI, StandardCharsets.UTF_8.name()) + "&scope=" + SCOPE + "&client_id=" + CLIENT_ID + "&code_challenge_method=S256" + "&code_challenge=" + oauth2Service.codeChallenge() + "&bic=" + BIC, uri.toString()); Mockito.verifyNoInteractions(httpClient); }
@Test void getAuthorizationRequestUriWithAisScopeMapping() throws IOException { Parameters parameters = new Parameters(); parameters.setRedirectUri(REDIRECT_URI); parameters.setScope(Scope.AIS_TRANSACTIONS.getValue()); URI uri = oauth2Service.getAuthorizationRequestUri(Collections.emptyMap(), parameters); assertEquals(AUTH_HOST + "/oauth2/authorize" + "?response_type=code" + "&redirect_uri=" + URLEncoder.encode(REDIRECT_URI, StandardCharsets.UTF_8.name()) + "&scope=" + SCOPE + "&client_id=" + CLIENT_ID + "&code_challenge_method=S256" + "&code_challenge=" + oauth2Service.codeChallenge() + "&bic=" + BIC, uri.toString()); Mockito.verifyNoInteractions(httpClient); }