### Question:
PisCancellationController implements PisCancellationApi { @Override public ResponseEntity<PaymentAuthorizeResponse> authorisePayment(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 authorizeCancelPaymentWorkflow = paymentService.authorizeCancelPayment(identifyPaymentWorkflow, psuId, authCode); responseUtils.setCookies(response, authorizeCancelPaymentWorkflow.getConsentReference(), authorizeCancelPaymentWorkflow.bearerToken().getAccess_token(), authorizeCancelPaymentWorkflow.bearerToken().getAccessTokenObject()); log.info("Confirmation code: {}", authorizeCancelPaymentWorkflow.getAuthResponse().getAuthConfirmationCode()); return ResponseEntity.ok(authorizeCancelPaymentWorkflow.getAuthResponse()); } catch (PaymentAuthorizeException e) { return e.getError(); } finally { authInterceptor.setAccessToken(null); } }  @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> selectMethod(String encryptedPaymentId, String authorisationId,
                                                                 String scaMethodId, String consentAndAccessTokenCookieString); @Override ResponseEntity<PaymentAuthorizeResponse> authorisePayment(String encryptedPaymentId, String authorisationId,
                                                                     String consentAndAccessTokenCookieString, String authCode); @Override ResponseEntity<PaymentAuthorizeResponse> pisDone(String encryptedPaymentId, String authorisationId,
                                                            String consentAndAccessTokenCookieString, boolean isOauth2Integrated, String authConfirmationCode);  }### Answer:
@Test void authorisePayment() 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, ACSP)); when(paymentService.authorizeCancelPayment(any(), anyString(), anyString())).thenReturn(getPaymentWorkflow(FINALISED, ACSP)); ResponseEntity<PaymentAuthorizeResponse> result = controller.authorisePayment(ENCRYPTED_ID, AUTH_ID, METHOD_ID, COOKIE); assertEquals(ResponseEntity.ok(getPaymentAuthorizeResponse(true, true, FINALISED)), result); }