### Question:
Xs2aAisConsentService { public boolean findAndTerminateOldConsentsByNewConsentId(String newConsentId) { CmsResponse<Boolean> response = consentService.findAndTerminateOldConsentsByNewConsentId(newConsentId); return response.isSuccessful() && response.getPayload(); }  Optional<Xs2aCreateAisConsentResponse> createConsent(CreateConsentReq request, PsuIdData psuData, TppInfo tppInfo); Optional<AisConsent> getAccountConsentById(String consentId); boolean findAndTerminateOldConsentsByNewConsentId(String newConsentId); void updateConsentStatus(String consentId, ConsentStatus consentStatus); void consentActionLog(String tppId, String consentId, ActionStatus actionStatus, String requestUri, boolean updateUsage,
                                 String resourceId, String transactionId); void updateConsentAuthorisation(UpdateConsentPsuDataReq updatePsuData); CmsResponse<AisConsent> updateAspspAccountAccess(String consentId, AccountAccess accountAccess); Optional<List<String>> getAuthorisationSubResources(String consentId); void updateMultilevelScaRequired(String consentId, boolean multilevelScaRequired);  }### Answer:
@Test void findAndTerminateOldConsentsByNewConsentId_success() { when(consentServiceEncrypted.findAndTerminateOldConsentsByNewConsentId(CONSENT_ID)) .thenReturn(CmsResponse.<Boolean>builder().payload(true).build()); boolean actualResponse = xs2aAisConsentService.findAndTerminateOldConsentsByNewConsentId(CONSENT_ID); assertThat(actualResponse).isTrue(); }
@Test void findAndTerminateOldConsentsByNewConsentId_false() { when(consentServiceEncrypted.findAndTerminateOldConsentsByNewConsentId(CONSENT_ID)) .thenReturn(CmsResponse.<Boolean>builder().payload(false).build()); boolean actualResponse = xs2aAisConsentService.findAndTerminateOldConsentsByNewConsentId(CONSENT_ID); assertThat(actualResponse).isFalse(); }