### Question:
AuthorisationServiceInternalEncrypted implements AuthorisationServiceEncrypted { @Transactional @Override public CmsResponse<ScaStatus> getAuthorisationScaStatus(String authorisationId, AuthorisationParentHolder parentHolder) { String encryptedId = parentHolder.getParentId(); Optional<String> decryptedIdOptional = securityDataService.decryptId(encryptedId); if (decryptedIdOptional.isEmpty()) { log.info("Encrypted Parent ID: [{}]. Get SCA status has failed, couldn't decrypt parent id", encryptedId); return CmsResponse.<ScaStatus>builder() .error(TECHNICAL_ERROR) .build(); } return authorisationService.getAuthorisationScaStatus(authorisationId, new AuthorisationParentHolder(parentHolder.getAuthorisationType(), decryptedIdOptional.get())); }  @Transactional @Override CmsResponse<CreateAuthorisationResponse> createAuthorisation(AuthorisationParentHolder parentHolder, CreateAuthorisationRequest request); @Transactional(readOnly = true) @Override CmsResponse<Authorisation> getAuthorisationById(String authorisationId); @Transactional @Override CmsResponse<Authorisation> updateAuthorisation(String authorisationId, UpdateAuthorisationRequest request); @Transactional @Override CmsResponse<Boolean> updateAuthorisationStatus(String authorisationId, ScaStatus scaStatus); @Transactional @Override CmsResponse<List<String>> getAuthorisationsByParentId(AuthorisationParentHolder parentHolder); @Transactional @Override CmsResponse<ScaStatus> getAuthorisationScaStatus(String authorisationId, AuthorisationParentHolder parentHolder); @Transactional(readOnly = true) @Override CmsResponse<Boolean> isAuthenticationMethodDecoupled(String authorisationId, String authenticationMethodId); @Transactional @Override CmsResponse<Boolean> saveAuthenticationMethods(String authorisationId, List<CmsScaMethod> methods); @Transactional @Override CmsResponse<Boolean> updateScaApproach(String authorisationId, ScaApproach scaApproach); @Transactional(readOnly = true) @Override CmsResponse<AuthorisationScaApproachResponse> getAuthorisationScaApproach(String authorisationId);  }### Answer:
@Test void getAuthorisationScaStatus() { AuthorisationParentHolder encryptedParentHolder = new AuthorisationParentHolder(AUTHORISATION_TYPE, ENCRYPTED_PARENT_ID); when(securityDataService.decryptId(ENCRYPTED_PARENT_ID)).thenReturn(Optional.of(DECRYPTED_PARENT_ID)); AuthorisationParentHolder decryptedParentHolder = new AuthorisationParentHolder(AUTHORISATION_TYPE, DECRYPTED_PARENT_ID); ScaStatus scaStatus = ScaStatus.RECEIVED; CmsResponse<ScaStatus> innerServiceResponse = CmsResponse.<ScaStatus>builder().payload(scaStatus).build(); when(authorisationService.getAuthorisationScaStatus(AUTHORISATION_ID, decryptedParentHolder)).thenReturn(innerServiceResponse); CmsResponse<ScaStatus> actualResponse = authorisationServiceInternalEncrypted.getAuthorisationScaStatus(AUTHORISATION_ID, encryptedParentHolder); assertEquals(innerServiceResponse, actualResponse); verify(authorisationService).getAuthorisationScaStatus(AUTHORISATION_ID, decryptedParentHolder); }
@Test void getAuthorisationScaStatus_malformedEncryptedId() { AuthorisationParentHolder encryptedParentHolder = new AuthorisationParentHolder(AUTHORISATION_TYPE, MALFORMED_ENCRYPTED_PARENT_ID); when(securityDataService.decryptId(MALFORMED_ENCRYPTED_PARENT_ID)).thenReturn(Optional.empty()); CmsResponse<ScaStatus> actualResponse = authorisationServiceInternalEncrypted.getAuthorisationScaStatus(AUTHORISATION_ID, encryptedParentHolder); assertTrue(actualResponse.hasError()); assertEquals(CmsError.TECHNICAL_ERROR, actualResponse.getError()); verify(authorisationService, never()).getAuthorisationScaStatus(any(), any()); }