@Test void getListOfAccounts() throws NoSuchFieldException { FieldSetter.setField(controller, controller.getClass().getDeclaredField("middlewareAuth"), new ObaMiddlewareAuthentication(null, new BearerTokenTO(TOKEN, null, 999, null, getAccessTokenTO()))); when(accountRestClient.getListOfAccounts()).thenReturn(ResponseEntity.ok(getAccounts())); ResponseEntity<List<AccountDetailsTO>> result = controller.getListOfAccounts(COOKIE); assertEquals(ResponseEntity.ok(getAccounts()), result); }
@Override public ResponseEntity<List<AccountDetailsTO>> getListOfAccounts(String accessTokenCookieString) { try { authInterceptor.setAccessToken(middlewareAuth.getBearerToken().getAccess_token()); ResponseEntity<List<AccountDetailsTO>> listOfAccounts = accountRestClient.getListOfAccounts(); return ResponseEntity.ok(listOfAccounts.getBody()); } finally { authInterceptor.setAccessToken(null); } }
AISController implements AISApi { @Override public ResponseEntity<List<AccountDetailsTO>> getListOfAccounts(String accessTokenCookieString) { try { authInterceptor.setAccessToken(middlewareAuth.getBearerToken().getAccess_token()); ResponseEntity<List<AccountDetailsTO>> listOfAccounts = accountRestClient.getListOfAccounts(); return ResponseEntity.ok(listOfAccounts.getBody()); } finally { authInterceptor.setAccessToken(null); } } }
AISController implements AISApi { @Override public ResponseEntity<List<AccountDetailsTO>> getListOfAccounts(String accessTokenCookieString) { try { authInterceptor.setAccessToken(middlewareAuth.getBearerToken().getAccess_token()); ResponseEntity<List<AccountDetailsTO>> listOfAccounts = accountRestClient.getListOfAccounts(); return ResponseEntity.ok(listOfAccounts.getBody()); } finally { authInterceptor.setAccessToken(null); } }  }
AISController implements AISApi { @Override public ResponseEntity<List<AccountDetailsTO>> getListOfAccounts(String accessTokenCookieString) { try { authInterceptor.setAccessToken(middlewareAuth.getBearerToken().getAccess_token()); ResponseEntity<List<AccountDetailsTO>> listOfAccounts = accountRestClient.getListOfAccounts(); return ResponseEntity.ok(listOfAccounts.getBody()); } finally { authInterceptor.setAccessToken(null); } }  @Override @ApiOperation(value = "Entry point for authenticating ais consent requests.") ResponseEntity<AuthorizeResponse> aisAuth(String redirectId, String encryptedConsentId, String token); @Override ResponseEntity<ConsentAuthorizeResponse> login(String encryptedConsentId, String authorisationId, String login, String pin, String consentCookieString); @Override ResponseEntity<ConsentAuthorizeResponse> startConsentAuth(String encryptedConsentId, String authorisationId, String consentAndAccessTokenCookieString, AisConsentTO aisConsent); @Override ResponseEntity<ConsentAuthorizeResponse> authrizedConsent(String encryptedConsentId, String authorisationId, String consentAndAccessTokenCookieString, String authCode); @Override ResponseEntity<ConsentAuthorizeResponse> selectMethod(String encryptedConsentId, String authorisationId, String scaMethodId, String consentAndAccessTokenCookieString); @Override ResponseEntity<List<AccountDetailsTO>> getListOfAccounts(String accessTokenCookieString); @Override ResponseEntity<ConsentAuthorizeResponse> aisDone(String encryptedConsentId, String authorisationId, String cookie, boolean isOauth2Integrated, String authConfirmationCode); @Override ResponseEntity<ConsentAuthorizeResponse> revokeConsent(@NotNull String encryptedConsentId, @NotNull String authorisationId, String cookieString); }
AISController implements AISApi { @Override public ResponseEntity<List<AccountDetailsTO>> getListOfAccounts(String accessTokenCookieString) { try { authInterceptor.setAccessToken(middlewareAuth.getBearerToken().getAccess_token()); ResponseEntity<List<AccountDetailsTO>> listOfAccounts = accountRestClient.getListOfAccounts(); return ResponseEntity.ok(listOfAccounts.getBody()); } finally { authInterceptor.setAccessToken(null); } }  @Override @ApiOperation(value = "Entry point for authenticating ais consent requests.") ResponseEntity<AuthorizeResponse> aisAuth(String redirectId, String encryptedConsentId, String token); @Override ResponseEntity<ConsentAuthorizeResponse> login(String encryptedConsentId, String authorisationId, String login, String pin, String consentCookieString); @Override ResponseEntity<ConsentAuthorizeResponse> startConsentAuth(String encryptedConsentId, String authorisationId, String consentAndAccessTokenCookieString, AisConsentTO aisConsent); @Override ResponseEntity<ConsentAuthorizeResponse> authrizedConsent(String encryptedConsentId, String authorisationId, String consentAndAccessTokenCookieString, String authCode); @Override ResponseEntity<ConsentAuthorizeResponse> selectMethod(String encryptedConsentId, String authorisationId, String scaMethodId, String consentAndAccessTokenCookieString); @Override ResponseEntity<List<AccountDetailsTO>> getListOfAccounts(String accessTokenCookieString); @Override ResponseEntity<ConsentAuthorizeResponse> aisDone(String encryptedConsentId, String authorisationId, String cookie, boolean isOauth2Integrated, String authConfirmationCode); @Override ResponseEntity<ConsentAuthorizeResponse> revokeConsent(@NotNull String encryptedConsentId, @NotNull String authorisationId, String cookieString);  }