### Question:
CmsConsentMapper { public ConsentEntity mapToNewConsentEntity(CmsConsent cmsConsent) { ConsentEntity entity = new ConsentEntity(); entity.setData(cmsConsent.getConsentData()); entity.setChecksum(cmsConsent.getChecksum()); entity.setExternalId(UUID.randomUUID().toString()); entity.setConsentStatus(cmsConsent.getConsentStatus()); entity.setConsentType(cmsConsent.getConsentType().getName()); entity.setFrequencyPerDay(cmsConsent.getFrequencyPerDay()); entity.setMultilevelScaRequired(cmsConsent.isMultilevelScaRequired()); entity.setRequestDateTime(OffsetDateTime.now()); entity.setValidUntil(cmsConsent.getValidUntil()); entity.setExpireDate(cmsConsent.getExpireDate()); entity.setPsuDataList(psuDataMapper.mapToPsuDataList(cmsConsent.getPsuIdDataList(), cmsConsent.getInstanceId())); entity.getPsuDataList().forEach(p -> p.setInstanceId(cmsConsent.getInstanceId())); entity.setAuthorisationTemplate(authorisationTemplateMapper.mapToAuthorisationTemplateEntity(cmsConsent.getAuthorisationTemplate())); entity.setRecurringIndicator(cmsConsent.isRecurringIndicator()); entity.setLastActionDate(LocalDate.now()); entity.setInternalRequestId(cmsConsent.getInternalRequestId()); entity.setTppInformation(consentTppInformationMapper.mapToConsentTppInformationEntity(cmsConsent.getTppInformation())); AccountAccess tppAccountAccesses = cmsConsent.getTppAccountAccesses(); entity.setTppAccountAccesses(accessMapper.mapToTppAccountAccess(tppAccountAccesses)); entity.setAspspAccountAccesses(accessMapper.mapToAspspAccountAccess(cmsConsent.getAspspAccountAccesses())); entity.setInstanceId(cmsConsent.getInstanceId()); AdditionalInformationAccess additionalInformationAccess = tppAccountAccesses.getAdditionalInformationAccess(); if (additionalInformationAccess != null) { entity.setOwnerNameType(AdditionalAccountInformationType.findTypeByList(additionalInformationAccess.getOwnerName())); entity.setTrustedBeneficiariesType(AdditionalAccountInformationType.findTypeByList(additionalInformationAccess.getTrustedBeneficiaries())); } return entity; }  List<CmsConsent> mapToCmsConsents(List<ConsentEntity> entities, Map<String, List<AuthorisationEntity>> authorisation, Map<String, Map<String, Integer>> usages); CmsConsent mapToCmsConsent(ConsentEntity entity, List<AuthorisationEntity> authorisations, Map<String, Integer> usages); ConsentEntity mapToNewConsentEntity(CmsConsent cmsConsent);  }### Answer:
@Test void mapToNewConsentEntity() { CmsConsent cmsConsent = jsonReader.getObjectFromFile("json/service/mapper/cms-consent-mapper/new-cms-consent.json", CmsConsent.class); ConsentEntity actual = cmsConsentMapper.mapToNewConsentEntity(cmsConsent); ConsentEntity expected = jsonReader.getObjectFromFile("json/service/mapper/cms-consent-mapper/new-consent-entity.json", ConsentEntity.class); expected.setExternalId(actual.getExternalId()); expected.setLastActionDate(actual.getLastActionDate()); expected.setRequestDateTime(actual.getRequestDateTime()); expected.setCreationTimestamp(actual.getCreationTimestamp()); assertEquals(expected, actual); }