### Question:
ConsentServiceRemote implements ConsentServiceEncrypted { @Override public CmsResponse<CmsCreateConsentResponse> createConsent(CmsConsent cmsConsent) { try { ResponseEntity<CmsCreateConsentResponse> restResponse = consentRestTemplate.postForEntity(consentRemoteUrls.createConsent(), cmsConsent, CmsCreateConsentResponse.class); return CmsResponse.<CmsCreateConsentResponse>builder() .payload(restResponse.getBody()) .build(); } catch (CmsRestException cmsRestException) { log.info("Couldn't create new consent, HTTP response status: {}", cmsRestException.getHttpStatus()); } return CmsResponse.<CmsCreateConsentResponse>builder() .error(TECHNICAL_ERROR) .build(); }  @Override CmsResponse<CmsCreateConsentResponse> createConsent(CmsConsent cmsConsent); @Override CmsResponse<ConsentStatus> getConsentStatusById(String consentId); @Override CmsResponse<Boolean> updateConsentStatusById(String consentId, ConsentStatus status); @Override CmsResponse<CmsConsent> getConsentById(String consentId); @Override CmsResponse<Boolean> findAndTerminateOldConsentsByNewConsentId(String newConsentId); @Override CmsResponse<List<PsuIdData>> getPsuDataByConsentId(String consentId); @Override CmsResponse<Boolean> updateMultilevelScaRequired(String encryptedConsentId, boolean multilevelScaRequired);  }### Answer:
@Test void createConsent() { CmsConsent consentToCreate = new CmsConsent(); CmsConsent createdConsent = new CmsConsent(); CmsCreateConsentResponse createConsentResponse = new CmsCreateConsentResponse(CONSENT_ID, createdConsent); when(consentRemoteUrls.createConsent()).thenReturn(URL); when(consentRestTemplate.postForEntity(URL, consentToCreate, CmsCreateConsentResponse.class)) .thenReturn(new ResponseEntity<>(createConsentResponse, HttpStatus.CREATED)); CmsResponse<CmsCreateConsentResponse> actualResponse = consentServiceRemote.createConsent(consentToCreate); assertTrue(actualResponse.isSuccessful()); assertEquals(createConsentResponse, actualResponse.getPayload()); }
@Test void createConsent_cmsRestException() { CmsConsent consentToCreate = new CmsConsent(); when(consentRemoteUrls.createConsent()).thenReturn(URL); when(consentRestTemplate.postForEntity(URL, consentToCreate, CmsCreateConsentResponse.class)) .thenThrow(CmsRestException.class); CmsResponse<CmsCreateConsentResponse> actualResponse = consentServiceRemote.createConsent(consentToCreate); assertTrue(actualResponse.hasError()); assertEquals(CmsError.TECHNICAL_ERROR, actualResponse.getError()); }