diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AlternativePostalAddressDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AlternativePostalAddressDto.kt index c0be83fe7..6ef03b23f 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AlternativePostalAddressDto.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AlternativePostalAddressDto.kt @@ -29,10 +29,10 @@ import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializ @Schema(name = "AlternativePostalAddress", description = "Alternative Postal Address Part") data class AlternativePostalAddressDto( - @Schema(description = "Describes the PO Box or private Bag number the delivery should be placed at.") + @get:Schema(description = "Describes the PO Box or private Bag number the delivery should be placed at.") val deliveryServiceNumber: String = "", - @Schema(description = "The type of this specified delivery") + @get:Schema(description = "The type of this specified delivery") val deliveryServiceType: DeliveryServiceType = DeliveryServiceType.PO_BOX, @field:JsonUnwrapped diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/BasePostalAddressDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/BasePostalAddressDto.kt index daf01323b..151690b86 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/BasePostalAddressDto.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/BasePostalAddressDto.kt @@ -25,37 +25,34 @@ import io.swagger.v3.oas.annotations.media.Schema @Schema(name = "PostalAdress", description = "Address record for a business partner") data class BasePostalAddressDto( - @Schema(description = "Geographic coordinates to find this location") + @get:Schema(description = "Geographic coordinates to find this location") val geographicCoordinates: GeoCoordinateDto? = null, - @Schema(description = "Describes the country") + @get:Schema(description = "Describes the country") val country: CountryCode, - @Schema(description = "Identifying code of the Region within the country (e.g. Bayern)") + @get:Schema(description = "Identifying code of the Region within the country (e.g. Bayern)") val administrativeAreaLevel1: String? = null, - @Schema(description = "Further possibility to describe the region/address(e.g. County/Landkreis)") + @get:Schema(description = "Further possibility to describe the region/address(e.g. County/Landkreis)") val administrativeAreaLevel2: String? = null, - @Schema(description = "Further possibility to describe the region/address(e.g. Township/Gemeinde)") + @get:Schema(description = "Further possibility to describe the region/address(e.g. Township/Gemeinde)") val administrativeAreaLevel3: String? = null, - - @Schema(description = "Further possibility to describe the region/address(e.g. Sub-Province for China/Japan)") - val administrativeAreaLevel4: String? = null, - - @Schema(description ="A postal code, also known as postcode, PIN or ZIP Code") + + @get:Schema(description = "A postal code, also known as postcode, PIN or ZIP Code") val postCode: String? = null, - @Schema(description = "The city of the address (Synonym: Town, village, municipality)") + @get:Schema(description = "The city of the address (Synonym: Town, village, municipality)") val city: String, - @Schema(description = "Divides the city in several smaller areas") + @get:Schema(description = "Divides the city in several smaller areas") val districtLevel1: String? = null, - @Schema(description = "Divides the DistrictLevel1 in several smaller areas. Synonym: Subdistrict") + @get:Schema(description = "Divides the DistrictLevel1 in several smaller areas. Synonym: Subdistrict") val districtLevel2: String? = null, - @Schema(description = "Address country") + @get:Schema(description = "Address country") val street: StreetDto? = null, -) \ No newline at end of file + ) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/PhysicalPostalAddressDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/PhysicalPostalAddressDto.kt index 552fb3a5d..83b6c6761 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/PhysicalPostalAddressDto.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/PhysicalPostalAddressDto.kt @@ -26,23 +26,23 @@ import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializ @JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class) @Schema(name = "PhysicalPostalAddress", description = "Physical Postal Address Part") -data class PhysicalPostalAddressDto ( +data class PhysicalPostalAddressDto( @field:JsonUnwrapped val baseAddress: BasePostalAddressDto, - @Schema(description = "A separate postal code for a company, also known as postcode, PIN or ZIP Code") + @get:Schema(description = "A separate postal code for a company, also known as postcode, PIN or ZIP Code") val companyPostCode: String? = null, - @Schema(description = "The practice of designating an area for industrial development") + @get:Schema(description = "The practice of designating an area for industrial development") val industrialZone: String? = null, - @Schema(description = "Describes a specific building within the address") + @get:Schema(description = "Describes a specific building within the address") val building: String? = null, - @Schema(description = "Describes the floor/level the delivery shall take place") + @get:Schema(description = "Describes the floor/level the delivery shall take place") val floor: String? = null, - @Schema(description = "Describes the door/room/suite on the respective floor the delivery shall take place") + @get:Schema(description = "Describes the door/room/suite on the respective floor the delivery shall take place") val door: String? = null, ) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/BasePostalAddressResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/BasePostalAddressResponse.kt index 936a4176c..8f6f7e75b 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/BasePostalAddressResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/BasePostalAddressResponse.kt @@ -21,43 +21,42 @@ package org.eclipse.tractusx.bpdm.common.dto.response import com.neovisionaries.i18n.CountryCode import io.swagger.v3.oas.annotations.media.Schema -import org.eclipse.tractusx.bpdm.common.dto.* +import org.eclipse.tractusx.bpdm.common.dto.GeoCoordinateDto +import org.eclipse.tractusx.bpdm.common.dto.NameRegioncodeDto +import org.eclipse.tractusx.bpdm.common.dto.StreetDto import org.eclipse.tractusx.bpdm.common.dto.response.type.TypeKeyNameDto @Schema(name = "PostalAddressResponse", description = "Aaddress record of a business partner") data class BasePostalAddressResponse( - @Schema(description = "Geographic coordinates to find this location") + @get:Schema(description = "Geographic coordinates to find this location") val geographicCoordinates: GeoCoordinateDto? = null, - @Schema(description = "Describes the full name of the country") + @get:Schema(description = "Describes the full name of the country") val country: TypeKeyNameDto, - @Schema(description = "Region within the country") + @get:Schema(description = "Region within the country") val administrativeAreaLevel1: NameRegioncodeDto? = null, - @Schema(description = "Further possibility to describe the region/address(e.g. County)") + @get:Schema(description = "Further possibility to describe the region/address(e.g. County)") val administrativeAreaLevel2: String? = null, - @Schema(description = "Further possibility to describe the region/address(e.g. Township)") + @get:Schema(description = "Further possibility to describe the region/address(e.g. Township)") val administrativeAreaLevel3: String? = null, - @Schema(description = "Further possibility to describe the region/address(e.g. Sub-Province for China/Japan)") - val administrativeAreaLevel4: String? = null, - - @Schema(description ="A postal code, also known as postcode, PIN or ZIP Code") + @get:Schema(description = "A postal code, also known as postcode, PIN or ZIP Code") val postCode: String? = null, - @Schema(description = "The city of the address (Synonym: Town, village, municipality)") + @get:Schema(description = "The city of the address (Synonym: Town, village, municipality)") val city: String, - @Schema(description = "Divides the city in several smaller areas") + @get:Schema(description = "Divides the city in several smaller areas") val districtLevel1: String? = null, - @Schema(description = "Divides the DistrictLevel1 in several smaller areas. Synonym: Subdistrict") + @get:Schema(description = "Divides the DistrictLevel1 in several smaller areas. Synonym: Subdistrict") val districtLevel2: String? = null, - @Schema(description = "Street") + @get:Schema(description = "Street") val street: StreetDto? = null, -) \ No newline at end of file + ) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt index b0a7a12e7..277ed7c37 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt @@ -224,7 +224,6 @@ object SaasMappings { administrativeAreaLevel1 = map.adminAreaLevel1(), administrativeAreaLevel2 = map.adminAreaLevel2(), administrativeAreaLevel3 = null, - administrativeAreaLevel4 = null, postCode = map.postcode(), districtLevel1 = map.districtLevel1(), districtLevel2 = map.districtLevel2(), @@ -259,7 +258,6 @@ object SaasMappings { administrativeAreaLevel1 = map.adminAreaLevel1(), administrativeAreaLevel2 = map.adminAreaLevel2(), administrativeAreaLevel3 = null, - administrativeAreaLevel4 = null, postCode = map.postcode(), districtLevel1 = map.districtLevel1(), districtLevel2 = map.districtLevel2(), diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt index 84fbce269..c5662eae7 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt @@ -65,7 +65,6 @@ fun AlternativePostalAddressDto.toAlternativePostalAddressEntity(): AlternativeP administrativeAreaLevel1 = null, // TODO Add region mapping Logic administrativeAreaLevel2 = baseAddress.administrativeAreaLevel2, administrativeAreaLevel3 = baseAddress.administrativeAreaLevel3, - administrativeAreaLevel4 = baseAddress.administrativeAreaLevel4, postCode = baseAddress.postCode, city = baseAddress.city, districtLevel1 = baseAddress.districtLevel1, @@ -85,7 +84,6 @@ fun PhysicalPostalAddressDto.toPhysicalPostalAddressEntity(): PhysicalPostalAddr administrativeAreaLevel1 = null, // TODO Add region mapping Logic administrativeAreaLevel2 = baseAddress.administrativeAreaLevel2, administrativeAreaLevel3 = baseAddress.administrativeAreaLevel3, - administrativeAreaLevel4 = baseAddress.administrativeAreaLevel4, postCode = baseAddress.postCode, city = baseAddress.city, districtLevel1 = baseAddress.districtLevel1, @@ -153,13 +151,13 @@ fun ChangelogEntry.toGateDto(): ChangelogResponse { fun LegalEntityGateInputRequest.toLegalEntity(): LegalEntity { - val addressInputRequest =AddressGateInputRequest( + val addressInputRequest = AddressGateInputRequest( address = legalEntity.legalAddress, externalId = getMainAddressForLegalEntityExternalId(externalId), legalEntityExternalId = externalId ) - val legalEntity= LegalEntity( + val legalEntity = LegalEntity( bpn = bpn, externalId = externalId, currentness = createCurrentnessTimestamp(), @@ -167,9 +165,9 @@ fun LegalEntityGateInputRequest.toLegalEntity(): LegalEntity { legalName = legalEntity.legalName.toName() ) - legalEntity.identifiers.addAll( this.legalEntity.identifiers.map {toEntityIdentifier(it,legalEntity)}) - legalEntity.states.addAll(this.legalEntity.states.map { toEntityState(it,legalEntity) }) - legalEntity.classifications.addAll(this.legalEntity.classifications.map { toEntityClassification(it,legalEntity) }) + legalEntity.identifiers.addAll(this.legalEntity.identifiers.map { toEntityIdentifier(it, legalEntity) }) + legalEntity.states.addAll(this.legalEntity.states.map { toEntityState(it, legalEntity) }) + legalEntity.classifications.addAll(this.legalEntity.classifications.map { toEntityClassification(it, legalEntity) }) legalEntity.legalAddress = addressInputRequest.toAddressGate(legalEntity, null) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMapping.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMapping.kt index ec499a643..77ba63ef8 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMapping.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMapping.kt @@ -51,7 +51,7 @@ class SaasDtoToSaasAddressMapping(private val postalAdress: BasePostalAddressDto type = SaasAdministrativeAreaType.COUNTY.toSaasTypeDto() ) } - // TODO Where can administrativeAreaLevel3 and administrativeAreaLevel4 be stored in SaaS model? It's just ignored for now! + // TODO Where can administrativeAreaLevel3 be stored in SaaS model? It's just ignored for now! ) } diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMappingTest.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMappingTest.kt index 0bede0fc4..295f33113 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMappingTest.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMappingTest.kt @@ -23,7 +23,6 @@ class SaasDtoToSaasAddressMappingTest { assertThat(baseAddressDto.administrativeAreaLevel1).isEqualTo(findValue(addressSaas.administrativeAreas, REGION)) assertThat(baseAddressDto.administrativeAreaLevel2).isEqualTo(findValue(addressSaas.administrativeAreas, COUNTY)) assertThat(baseAddressDto.administrativeAreaLevel3).isEqualTo(null) - assertThat(baseAddressDto.administrativeAreaLevel4).isEqualTo(null) assertThat(baseAddressDto.city).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.CITY)) assertThat(baseAddressDto.country).isEqualTo(addressSaas.country?.shortName) assertThat(baseAddressDto.districtLevel1).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) @@ -58,7 +57,6 @@ class SaasDtoToSaasAddressMappingTest { } - @Test fun mappingAddressDto1Test() { @@ -69,7 +67,6 @@ class SaasDtoToSaasAddressMappingTest { assertThat(baseAddressDto.administrativeAreaLevel1).isEqualTo(findValue(addressSaas.administrativeAreas, REGION)) assertThat(baseAddressDto.administrativeAreaLevel2).isEqualTo(findValue(addressSaas.administrativeAreas, COUNTY)) assertThat(baseAddressDto.administrativeAreaLevel3).isEqualTo(null) - assertThat(baseAddressDto.administrativeAreaLevel4).isEqualTo(null) assertThat(baseAddressDto.city).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.CITY)) assertThat(baseAddressDto.country).isEqualTo(addressSaas.country?.shortName) assertThat(baseAddressDto.districtLevel1).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) @@ -98,7 +95,6 @@ class SaasDtoToSaasAddressMappingTest { assertThat(baseAddressDto.administrativeAreaLevel1).isEqualTo(findValue(addressSaas.administrativeAreas, REGION)) assertThat(baseAddressDto.administrativeAreaLevel2).isEqualTo(findValue(addressSaas.administrativeAreas, COUNTY)) assertThat(baseAddressDto.administrativeAreaLevel3).isEqualTo(null) - assertThat(baseAddressDto.administrativeAreaLevel4).isEqualTo(null) assertThat(baseAddressDto.city).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.CITY)) assertThat(baseAddressDto.country).isEqualTo(addressSaas.country?.shortName) assertThat(baseAddressDto.districtLevel1).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt index 429976f19..61dda4cfa 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt @@ -159,7 +159,7 @@ class BusinessPartnerBuildService( @Transactional fun updateLegalEntities(requests: Collection): LegalEntityPartnerUpdateResponseWrapper { logger.info { "Update ${requests.size} legal entities" } - + val legalEntityMetadataMap = metadataMappingService.mapRequests(requests.map { it.legalEntity }) val addressMetadataMap = metadataMappingService.mapRequests(requests.map { it.legalEntity.legalAddress }) @@ -173,7 +173,7 @@ class BusinessPartnerBuildService( } val requestByBpnMap = requests.associateBy { it.bpn } - legalEntities.forEach { + legalEntities.forEach { val request = requestByBpnMap.get(it.bpn)!! updateLegalEntity(it, request.legalEntity, legalEntityMetadataMap) updateLogisticAddress(it.legalAddress, request.legalEntity.legalAddress, addressMetadataMap) @@ -376,7 +376,7 @@ class BusinessPartnerBuildService( legalEntity: LegalEntity, metadataMap: AddressMetadataMappingDto ) = createLogisticAddressInternal(dto, bpn, metadataMap) - .also { it.legalEntity = legalEntity } + .also { it.legalEntity = legalEntity } private fun createLogisticAddress( dto: LogisticAddressDto, @@ -384,7 +384,7 @@ class BusinessPartnerBuildService( site: Site, metadataMap: AddressMetadataMappingDto ) = createLogisticAddressInternal(dto, bpn, metadataMap) - .also { it.site = site } + .also { it.site = site } private fun createLogisticAddressInternal( dto: LogisticAddressDto, @@ -431,7 +431,6 @@ class BusinessPartnerBuildService( administrativeAreaLevel1 = null, administrativeAreaLevel2 = baseAddress.administrativeAreaLevel2, administrativeAreaLevel3 = baseAddress.administrativeAreaLevel3, - administrativeAreaLevel4 = baseAddress.administrativeAreaLevel4, postCode = baseAddress.postCode, city = baseAddress.city, districtLevel1 = baseAddress.districtLevel1, @@ -457,7 +456,6 @@ class BusinessPartnerBuildService( administrativeAreaLevel1 = null, administrativeAreaLevel2 = baseAddress.administrativeAreaLevel2, administrativeAreaLevel3 = baseAddress.administrativeAreaLevel3, - administrativeAreaLevel4 = baseAddress.administrativeAreaLevel4, postCode = baseAddress.postCode, city = baseAddress.city, districtLevel1 = baseAddress.districtLevel1, diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt index 857c19ab2..5265d0967 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt @@ -154,7 +154,6 @@ fun PhysicalPostalAddress.toDto(): PhysicalPostalAddressResponse { administrativeAreaLevel1 = administrativeAreaLevel1?.let { NameRegioncodeDto(it.regionName, it.regionCode) }, administrativeAreaLevel2 = administrativeAreaLevel2, administrativeAreaLevel3 = administrativeAreaLevel3, - administrativeAreaLevel4 = administrativeAreaLevel4, postCode = postCode, city = city, districtLevel1 = districtLevel1, @@ -177,7 +176,6 @@ fun AlternativePostalAddress.toDto(): AlternativePostalAddressResponse { administrativeAreaLevel1 = administrativeAreaLevel1?.let { NameRegioncodeDto(it.regionName, it.regionCode) }, administrativeAreaLevel2 = administrativeAreaLevel2, administrativeAreaLevel3 = administrativeAreaLevel3, - administrativeAreaLevel4 = administrativeAreaLevel4, postCode = postCode, city = city, districtLevel1 = districtLevel1, diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMappingTest.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMappingTest.kt index 098ceb5a5..69d073a1d 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMappingTest.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMappingTest.kt @@ -34,9 +34,9 @@ class SaasAddressToDtoMappingTest { @Test fun addressPartnerTest() { - checkMappingResponsePhysicalAddress( ResponseValues.addressPartner1.physicalPostalAddress, SaasValues.addressPartnerSaas1.addresses.first()) - checkMappingResponsePhysicalAddress( ResponseValues.addressPartner2.physicalPostalAddress, SaasValues.addressPartnerSaas2.addresses.first()) - checkMappingResponsePhysicalAddress( ResponseValues.addressPartner3.physicalPostalAddress, SaasValues.addressPartnerSaas3.addresses.first()) + checkMappingResponsePhysicalAddress(ResponseValues.addressPartner1.physicalPostalAddress, SaasValues.addressPartnerSaas1.addresses.first()) + checkMappingResponsePhysicalAddress(ResponseValues.addressPartner2.physicalPostalAddress, SaasValues.addressPartnerSaas2.addresses.first()) + checkMappingResponsePhysicalAddress(ResponseValues.addressPartner3.physicalPostalAddress, SaasValues.addressPartnerSaas3.addresses.first()) } @Test @@ -44,9 +44,9 @@ class SaasAddressToDtoMappingTest { val addressesMapping = SaasAddressesMapping(SaasValues.addressPartner1.addresses) val address = addressesMapping.saasPhysicalAddressMapping()!! - val physicalAddressDto = SaasMappings.toPhysicalAddress(address, "") + val physicalAddressDto = SaasMappings.toPhysicalAddress(address, "") - checkMappingDtoPhysicalAddress( physicalAddressDto, SaasValues.addressPartner1.addresses.first()) + checkMappingDtoPhysicalAddress(physicalAddressDto, SaasValues.addressPartner1.addresses.first()) } @@ -56,7 +56,6 @@ class SaasAddressToDtoMappingTest { //TODO Assertions.assertThat(baseAddressDto.administrativeAreaLevel1?.name).isEqualTo(findValue(addressSaas.administrativeAreas, SaasAdministrativeAreaType.REGION)) Assertions.assertThat(baseAddressDto.administrativeAreaLevel2).isEqualTo(findValue(addressSaas.administrativeAreas, SaasAdministrativeAreaType.COUNTY)) Assertions.assertThat(baseAddressDto.administrativeAreaLevel3).isEqualTo(null) - Assertions.assertThat(baseAddressDto.administrativeAreaLevel4).isEqualTo(null) Assertions.assertThat(baseAddressDto.city).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.CITY)) Assertions.assertThat(baseAddressDto.country.technicalKey).isEqualTo(addressSaas.country?.shortName) Assertions.assertThat(baseAddressDto.districtLevel1).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) @@ -74,13 +73,13 @@ class SaasAddressToDtoMappingTest { Assertions.assertThat(physicalAddressDto.floor).isEqualTo(findValue(addressSaas.premises, SaasPremiseType.LEVEL)) Assertions.assertThat(physicalAddressDto.door).isEqualTo(findValue(addressSaas.premises, SaasPremiseType.ROOM)) } + private fun checkMappingDtoPhysicalAddress(physicalAddressDto: PhysicalPostalAddressDto, addressSaas: AddressSaas) { val baseAddressDto = physicalAddressDto.baseAddress Assertions.assertThat(baseAddressDto.administrativeAreaLevel1).isEqualTo(findValue(addressSaas.administrativeAreas, SaasAdministrativeAreaType.REGION)) Assertions.assertThat(baseAddressDto.administrativeAreaLevel2).isEqualTo(findValue(addressSaas.administrativeAreas, SaasAdministrativeAreaType.COUNTY)) Assertions.assertThat(baseAddressDto.administrativeAreaLevel3).isEqualTo(null) - Assertions.assertThat(baseAddressDto.administrativeAreaLevel4).isEqualTo(null) Assertions.assertThat(baseAddressDto.city).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.CITY)) Assertions.assertThat(baseAddressDto.country).isEqualTo(addressSaas.country?.shortName) Assertions.assertThat(baseAddressDto.districtLevel1).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT))