### Question:
AuthorisationServiceRemote implements AuthorisationServiceEncrypted { @Override public CmsResponse<CreateAuthorisationResponse> createAuthorisation(AuthorisationParentHolder parentHolder, CreateAuthorisationRequest request) { try { CreateAuthorisationResponse response = consentRestTemplate.postForEntity(authorisationRemoteUrls.createAuthorisation(), request, CreateAuthorisationResponse.class, parentHolder.getAuthorisationType(), parentHolder.getParentId()).getBody(); return CmsResponse.<CreateAuthorisationResponse>builder() .payload(response) .build(); } catch (CmsRestException cmsRestException) { log.info("Couldn't create new authorisation, HTTP response status: {}", cmsRestException.getHttpStatus()); } return CmsResponse.<CreateAuthorisationResponse>builder() .error(TECHNICAL_ERROR) .build(); }  @Override CmsResponse<CreateAuthorisationResponse> createAuthorisation(AuthorisationParentHolder parentHolder, CreateAuthorisationRequest request); @Override CmsResponse<Authorisation> getAuthorisationById(String authorisationId); @Override CmsResponse<Authorisation> updateAuthorisation(String authorisationId, UpdateAuthorisationRequest request); @Override CmsResponse<Boolean> updateAuthorisationStatus(String authorisationId, ScaStatus scaStatus); @Override CmsResponse<List<String>> getAuthorisationsByParentId(AuthorisationParentHolder parentHolder); @Override CmsResponse<ScaStatus> getAuthorisationScaStatus(String authorisationId, AuthorisationParentHolder parentHolder); @Override CmsResponse<Boolean> isAuthenticationMethodDecoupled(String authorisationId, String authenticationMethodId); @Override CmsResponse<Boolean> saveAuthenticationMethods(String authorisationId, List<CmsScaMethod> methods); @Override CmsResponse<Boolean> updateScaApproach(String authorisationId, ScaApproach scaApproach); @Override CmsResponse<AuthorisationScaApproachResponse> getAuthorisationScaApproach(String authorisationId);  }### Answer:
@Test void createAuthorisation() { when(authorisationRemoteUrls.createAuthorisation()).thenReturn(URL); AuthorisationParentHolder authorisationParentHolder = new AuthorisationParentHolder(AUTHORISATION_TYPE, PARENT_ID); CreateAuthorisationRequest createAuthorisationRequest = new CreateAuthorisationRequest(); CreateAuthorisationResponse controllerResponse = new CreateAuthorisationResponse(AUTHORISATION_ID, ScaStatus.RECEIVED, "internal request id", new PsuIdData()); when(consentRestTemplate.postForEntity(URL, createAuthorisationRequest, CreateAuthorisationResponse.class, AUTHORISATION_TYPE, PARENT_ID)) .thenReturn(new ResponseEntity<>(controllerResponse, HttpStatus.CREATED)); CmsResponse<CreateAuthorisationResponse> actualResponse = authorisationServiceRemote.createAuthorisation(authorisationParentHolder, createAuthorisationRequest); assertTrue(actualResponse.isSuccessful()); assertEquals(controllerResponse, actualResponse.getPayload()); }
@Test void createAuthorisation_cmsRestException() { when(authorisationRemoteUrls.createAuthorisation()).thenReturn(URL); AuthorisationParentHolder authorisationParentHolder = new AuthorisationParentHolder(AUTHORISATION_TYPE, PARENT_ID); CreateAuthorisationRequest createAuthorisationRequest = new CreateAuthorisationRequest(); when(consentRestTemplate.postForEntity(URL, createAuthorisationRequest, CreateAuthorisationResponse.class, AUTHORISATION_TYPE, PARENT_ID)) .thenThrow(CmsRestException.class); CmsResponse<CreateAuthorisationResponse> actualResponse = authorisationServiceRemote.createAuthorisation(authorisationParentHolder, createAuthorisationRequest); assertTrue(actualResponse.hasError()); assertEquals(CmsError.TECHNICAL_ERROR, actualResponse.getError()); }