### Question:
ConsentServiceRemote implements ConsentServiceEncrypted { @Override public CmsResponse<Boolean> findAndTerminateOldConsentsByNewConsentId(String newConsentId) { try { consentRestTemplate.delete(consentRemoteUrls.findAndTerminateOldConsentsByNewConsentId(), newConsentId); return CmsResponse.<Boolean>builder() .payload(true) .build(); } catch (CmsRestException cmsRestException) { log.info("Couldn't terminate old consents by new consent ID {}, HTTP response status: {}", newConsentId, cmsRestException.getHttpStatus()); } return CmsResponse.<Boolean>builder() .payload(false) .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 findAndTerminateOldConsentsByNewConsentId() { when(consentRemoteUrls.findAndTerminateOldConsentsByNewConsentId()).thenReturn(URL); CmsResponse<Boolean> actualResponse = consentServiceRemote.findAndTerminateOldConsentsByNewConsentId(CONSENT_ID); assertTrue(actualResponse.isSuccessful()); assertTrue(actualResponse.getPayload()); verify(consentRestTemplate).delete(URL, CONSENT_ID); }
@Test void findAndTerminateOldConsentsByNewConsentId_cmsRestException() { when(consentRemoteUrls.findAndTerminateOldConsentsByNewConsentId()).thenReturn(URL); doThrow(CmsRestException.class).when(consentRestTemplate).delete(URL, CONSENT_ID); CmsResponse<Boolean> actualResponse = consentServiceRemote.findAndTerminateOldConsentsByNewConsentId(CONSENT_ID); assertTrue(actualResponse.isSuccessful()); assertFalse(actualResponse.getPayload()); verify(consentRestTemplate).delete(URL, CONSENT_ID); }