### Question:
PISController implements PISApi { @Override public ResponseEntity<PaymentAuthorizeResponse> authrizedPayment( String encryptedPaymentId, String authorisationId, String consentAndaccessTokenCookieString, String authCode) { String psuId = AuthUtils.psuId(middlewareAuth); try { String consentCookie = responseUtils.consentCookie(consentAndaccessTokenCookieString); PaymentWorkflow identifyPaymentWorkflow = paymentService.identifyPayment(encryptedPaymentId, authorisationId, true, consentCookie, psuId, middlewareAuth.getBearerToken()); PaymentWorkflow authorizePaymentWorkflow = paymentService.authorizePayment(identifyPaymentWorkflow, psuId, authCode); responseUtils.setCookies(response, authorizePaymentWorkflow.getConsentReference(), authorizePaymentWorkflow.bearerToken().getAccess_token(), authorizePaymentWorkflow.bearerToken().getAccessTokenObject()); log.info("Confirmation code: {}", authorizePaymentWorkflow.getAuthResponse().getAuthConfirmationCode()); return ResponseEntity.ok(authorizePaymentWorkflow.getAuthResponse()); } catch (PaymentAuthorizeException e) { return e.getError(); } finally { authInterceptor.setAccessToken(null); } }  @Override ResponseEntity<AuthorizeResponse> pisAuth(String redirectId, String encryptedPaymentId, String token); @Override @ApiOperation(value = "Identifies the user by login an pin. Return sca methods information") ResponseEntity<PaymentAuthorizeResponse> login(String encryptedPaymentId, String authorisationId, String login, String pin, String consentCookieString); @Override ResponseEntity<PaymentAuthorizeResponse> initiatePayment(
        String encryptedPaymentId, String authorisationId, String consentAndaccessTokenCookieString); @Override ResponseEntity<PaymentAuthorizeResponse> selectMethod(String encryptedPaymentId, String authorisationId,
                                                                 String scaMethodId, String consentAndaccessTokenCookieString); @Override ResponseEntity<PaymentAuthorizeResponse> authrizedPayment(
        String encryptedPaymentId,
        String authorisationId,
        String consentAndaccessTokenCookieString, String authCode); @Override ResponseEntity<PaymentAuthorizeResponse> failPaymentAuthorisation(String encryptedPaymentId, String authorisationId, String cookieString); @Override ResponseEntity<PaymentAuthorizeResponse> pisDone(String encryptedPaymentId, String authorisationId,
                                                            String consentAndAccessTokenCookieString, boolean isOauth2Integrated, String authConfirmationCode);  }### Answer:
@Test void authrizedPayment() throws NoSuchFieldException { FieldSetter.setField(controller, controller.getClass().getDeclaredField("middlewareAuth"), new ObaMiddlewareAuthentication(null, new BearerTokenTO(TOKEN, null, 999, null, getAccessTokenTO()))); when(responseUtils.consentCookie(any())).thenReturn(COOKIE); when(paymentService.identifyPayment(anyString(), anyString(), anyBoolean(), anyString(), anyString(), any())).thenReturn(getPaymentWorkflow(PSUIDENTIFIED)); when(paymentService.authorizePayment(any(), anyString(), anyString())).thenReturn(getPaymentWorkflow(FINALISED)); ResponseEntity<PaymentAuthorizeResponse> result = controller.authrizedPayment(ENCRYPTED_ID, AUTH_ID, METHOD_ID, COOKIE); assertEquals(ResponseEntity.ok(getPaymentAuthorizeResponse(true, true, FINALISED)), result); }