### Question:
Xs2aAuthorisationService { public Optional<AuthorisationScaApproachResponse> getAuthorisationScaApproach(String authorisationId) { CmsResponse<AuthorisationScaApproachResponse> response = authorisationServiceEncrypted.getAuthorisationScaApproach(authorisationId); if (response.hasError()) { return Optional.empty(); } return Optional.ofNullable(response.getPayload()); }  Optional<CreateAuthorisationResponse> createAuthorisation(CreateAuthorisationRequest request, String parentId, AuthorisationType authorisationType); Optional<Authorisation> getAuthorisationById(String authorisationId); void updateScaApproach(String authorisationId, ScaApproach scaApproach); boolean saveAuthenticationMethods(String authorisationId, List<AuthenticationObject> methods); boolean isAuthenticationMethodDecoupled(String authorisationId, String authenticationMethodId); void updateAuthorisationStatus(String authorisationId, ScaStatus scaStatus); Optional<AuthorisationScaApproachResponse> getAuthorisationScaApproach(String authorisationId); Optional<List<String>> getAuthorisationSubResources(String parentId, AuthorisationType authorisationType); CmsResponse<Authorisation> updateAuthorisation(UpdateAuthorisationRequest request, String authorisationId); Optional<ScaStatus> getAuthorisationScaStatus(String authorisationId, String parentId, AuthorisationType authorisationType);  }### Answer:
@Test void getAuthorisationScaApproach() { AuthorisationScaApproachResponse payload = new AuthorisationScaApproachResponse(ScaApproach.REDIRECT); when(authorisationServiceEncrypted.getAuthorisationScaApproach(AUTHORISATION_ID)) .thenReturn(CmsResponse.<AuthorisationScaApproachResponse>builder().payload(payload).build()); Optional<AuthorisationScaApproachResponse> actual = authorisationService.getAuthorisationScaApproach(AUTHORISATION_ID); assertTrue(actual.isPresent()); assertEquals(payload, actual.get()); }
@Test void getAuthorisationScaApproach_hasError() { when(authorisationServiceEncrypted.getAuthorisationScaApproach(AUTHORISATION_ID)) .thenReturn(CmsResponse.<AuthorisationScaApproachResponse>builder().error(CmsError.TECHNICAL_ERROR).build()); Optional<AuthorisationScaApproachResponse> actual = authorisationService.getAuthorisationScaApproach(AUTHORISATION_ID); assertTrue(actual.isEmpty()); }