### Question:
AdapterServiceLoader { public Oauth2Service getOauth2Service(RequestHeaders requestHeaders) { Aspsp aspsp = getAspsp(requestHeaders); String adapterId = aspsp.getAdapterId(); return getServiceProvider(Oauth2ServiceProvider.class, adapterId) .orElseThrow(() -> new AdapterNotFoundException(adapterId)) .getOauth2Service(aspsp, httpClientFactory, keyStore); } AdapterServiceLoader(AspspReadOnlyRepository aspspRepository,
                                Pkcs12KeyStore keyStore,
                                HttpClientFactory httpClientFactory,
                                LinksRewriter accountInformationLinksRewriter,
                                LinksRewriter paymentInitiationLinksRewriter,
                                boolean chooseFirstFromMultipleAspsps); AccountInformationService getAccountInformationService(RequestHeaders requestHeaders); Optional<T> getServiceProvider(Class<T> klass, String adapterId); PaymentInitiationService getPaymentInitiationService(RequestHeaders requestHeaders); Oauth2Service getOauth2Service(RequestHeaders requestHeaders); DownloadService getDownloadService(RequestHeaders requestHeaders);  }### Answer:
@Test void getOauth2Service() { Aspsp aspsp = buildAspsp(null, null, ADAPTER_ID); when(aspspRepository.findById(anyString())) .thenReturn(Optional.of(aspsp)); Oauth2Service actualService = adapterServiceLoader.getOauth2Service(requestHeadersWithAspspId); verify(aspspRepository, times(1)).findById(anyString()); assertThat(actualService).isInstanceOf(TestOauth2Service.class); }