### Question:
AisConsentMapper { public AisConsent mapToAisConsent(ConsentEntity entity, List<AuthorisationEntity> authorisations) { AisConsentData aisConsentData = consentDataMapper.mapToAisConsentData(entity.getData()); Map<String, Integer> usageCounterMap = aisConsentUsageService.getUsageCounterMap(entity); return new AisConsent(aisConsentData, entity.getExternalId(), entity.getInternalRequestId(), entity.getConsentStatus(), entity.getFrequencyPerDay(), entity.isRecurringIndicator(), entity.isMultilevelScaRequired(), entity.getValidUntil(), entity.getExpireDate(), entity.getLastActionDate(), entity.getCreationTimestamp(), entity.getStatusChangeTimestamp(), consentTppInformationMapper.mapToConsentTppInformation(entity.getTppInformation()), authorisationTemplateMapper.mapToAuthorisationTemplate(entity.getAuthorisationTemplate()), psuDataMapper.mapToPsuIdDataList(entity.getPsuDataList()), mapToAccountConsentAuthorisations(authorisations), usageCounterMap, accessMapper.mapTppAccessesToAccountAccess(entity.getTppAccountAccesses(), entity.getOwnerNameType(), entity.getTrustedBeneficiariesType()), accessMapper.mapAspspAccessesToAccountAccess(entity.getAspspAccountAccesses(), entity.getOwnerNameType(), entity.getTrustedBeneficiariesType()), entity.getInstanceId(), entity.isSigningBasketBlocked()); }  CmsAisAccountConsent mapToCmsAisAccountConsent(ConsentEntity consent, List<AuthorisationEntity> authorisations); AisConsent mapToAisConsent(ConsentEntity entity, List<AuthorisationEntity> authorisations); AccountAccess mapToAccountAccess(AisAccountAccess accountAccess);  }### Answer:
@Test void mapToAisConsent_emptyAuthorisations() { ConsentEntity consent = jsonReader .getObjectFromFile("json/service/mapper/ais-consent-mapper/consent-entity-tpp-aspsp-access.json", ConsentEntity.class); List<AuthorisationEntity> authorisations = Collections.emptyList(); when(aisConsentUsageService.getUsageCounterMap(consent)).thenReturn(USAGE_COUNTER); AisConsent result = aisConsentMapper.mapToAisConsent(consent, authorisations); AisConsent expected = jsonReader. getObjectFromFile("json/service/mapper/ais-consent-mapper/ais-consent-empty-authorisations.json", AisConsent.class); assertEquals(expected, result); }
@Test void mapToAisConsent() { ConsentEntity consent = jsonReader .getObjectFromFile("json/service/mapper/ais-consent-mapper/consent-entity-tpp-aspsp-access.json", ConsentEntity.class); List<AuthorisationEntity> authorisations = Collections.singletonList(buildAisConsentAuthorisation()); when(aisConsentUsageService.getUsageCounterMap(consent)).thenReturn(USAGE_COUNTER); AisConsent result = aisConsentMapper.mapToAisConsent(consent, authorisations); AisConsent expected = jsonReader .getObjectFromFile("json/service/mapper/ais-consent-mapper/ais-consent-with-authorisations.json", AisConsent.class); assertEquals(expected, result); }