Search in sources :

Example 1 with AddressDetailsDTO

use of eu.europa.ec.fisheries.ers.service.dto.fareport.details.AddressDetailsDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class StructuredAddressMapperTest method testStructuredAddressDetailsDTOListMapper.

@Test
public void testStructuredAddressDetailsDTOListMapper() {
    StructuredAddress structuredAddress = MapperUtil.getStructuredAddress();
    StructuredAddressEntity structuredAddressEntity = new StructuredAddressEntity();
    StructuredAddressTypeEnum structuredAddressTypeEnum = StructuredAddressTypeEnum.FLUX_PHYSICAL;
    FluxLocationEntity fluxLocationEntity = null;
    StructuredAddressMapper.INSTANCE.mapToStructuredAddress(structuredAddress, structuredAddressTypeEnum, fluxLocationEntity, structuredAddressEntity);
    List<AddressDetailsDTO> addressDetailsDTO = new ArrayList<>(StructuredAddressMapper.INSTANCE.mapToAddressDetailsDTOList(new HashSet<>(Arrays.asList(structuredAddressEntity))));
    assertEquals(structuredAddressEntity.getAddressId(), addressDetailsDTO.get(0).getAddressId());
    assertEquals(structuredAddressEntity.getBlockName(), addressDetailsDTO.get(0).getBlockName());
    assertEquals(structuredAddressEntity.getBuildingName(), addressDetailsDTO.get(0).getBuildingName());
    assertEquals(structuredAddressEntity.getCityName(), addressDetailsDTO.get(0).getCityName());
    assertEquals(structuredAddressEntity.getCitySubdivisionName(), addressDetailsDTO.get(0).getCitySubdivisionName());
    assertEquals(structuredAddressEntity.getCountry(), addressDetailsDTO.get(0).getCountry());
    assertEquals(structuredAddressEntity.getCountryName(), addressDetailsDTO.get(0).getCountryName());
    assertEquals(structuredAddressEntity.getCountrySubdivisionName(), addressDetailsDTO.get(0).getCountrySubdivisionName());
    assertEquals(structuredAddressEntity.getPlotId(), addressDetailsDTO.get(0).getPlotId());
    assertEquals(structuredAddressEntity.getPostcode(), addressDetailsDTO.get(0).getPostcode());
    assertEquals(structuredAddressEntity.getPostOfficeBox(), addressDetailsDTO.get(0).getPostOfficeBox());
    assertEquals(structuredAddressEntity.getStreetName(), addressDetailsDTO.get(0).getStreetName());
}
Also used : StructuredAddressTypeEnum(eu.europa.ec.fisheries.ers.fa.utils.StructuredAddressTypeEnum) StructuredAddressEntity(eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity) ArrayList(java.util.ArrayList) AddressDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.details.AddressDetailsDTO) StructuredAddress(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.StructuredAddress) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with AddressDetailsDTO

use of eu.europa.ec.fisheries.ers.service.dto.fareport.details.AddressDetailsDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class StructuredAddressMapperTest method testStructuredAddressDetailsDTOMapper.

@Test
public void testStructuredAddressDetailsDTOMapper() {
    StructuredAddress structuredAddress = MapperUtil.getStructuredAddress();
    StructuredAddressEntity structuredAddressEntity = new StructuredAddressEntity();
    StructuredAddressTypeEnum structuredAddressTypeEnum = StructuredAddressTypeEnum.FLUX_PHYSICAL;
    FluxLocationEntity fluxLocationEntity = null;
    StructuredAddressMapper.INSTANCE.mapToStructuredAddress(structuredAddress, structuredAddressTypeEnum, fluxLocationEntity, structuredAddressEntity);
    AddressDetailsDTO addressDetailsDTO = StructuredAddressMapper.INSTANCE.mapToAddressDetailsDTO(structuredAddressEntity);
    assertEquals(structuredAddressEntity.getAddressId(), addressDetailsDTO.getAddressId());
    assertEquals(structuredAddressEntity.getBlockName(), addressDetailsDTO.getBlockName());
    assertEquals(structuredAddressEntity.getBuildingName(), addressDetailsDTO.getBuildingName());
    assertEquals(structuredAddressEntity.getCityName(), addressDetailsDTO.getCityName());
    assertEquals(structuredAddressEntity.getCitySubdivisionName(), addressDetailsDTO.getCitySubdivisionName());
    assertEquals(structuredAddressEntity.getCountry(), addressDetailsDTO.getCountry());
    assertEquals(structuredAddressEntity.getCountryName(), addressDetailsDTO.getCountryName());
    assertEquals(structuredAddressEntity.getCountrySubdivisionName(), addressDetailsDTO.getCountrySubdivisionName());
    assertEquals(structuredAddressEntity.getPlotId(), addressDetailsDTO.getPlotId());
    assertEquals(structuredAddressEntity.getPostcode(), addressDetailsDTO.getPostcode());
    assertEquals(structuredAddressEntity.getPostOfficeBox(), addressDetailsDTO.getPostOfficeBox());
    assertEquals(structuredAddressEntity.getStreetName(), addressDetailsDTO.getStreetName());
}
Also used : StructuredAddressTypeEnum(eu.europa.ec.fisheries.ers.fa.utils.StructuredAddressTypeEnum) StructuredAddressEntity(eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity) AddressDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.details.AddressDetailsDTO) StructuredAddress(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.StructuredAddress) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) Test(org.junit.Test)

Example 3 with AddressDetailsDTO

use of eu.europa.ec.fisheries.ers.service.dto.fareport.details.AddressDetailsDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class FluxLocationMapperTest method getPhysicalAddressDetailsTest.

@Test
public void getPhysicalAddressDetailsTest() {
    FluxLocationEntity fluxLocationEntity = getFluxLocationEntityMock();
    AddressDetailsDTO fluxLocationDTO = FluxLocationMapper.INSTANCE.getPhysicalAddressDetails(fluxLocationEntity.getStructuredAddresses());
    assertNotNull(fluxLocationDTO);
    assertTrue(StringUtils.isNotEmpty(fluxLocationDTO.getBlockName()));
}
Also used : AddressDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.details.AddressDetailsDTO) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) Test(org.junit.Test)

Example 4 with AddressDetailsDTO

use of eu.europa.ec.fisheries.ers.service.dto.fareport.details.AddressDetailsDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class FluxLocationMapperTest method getPostalAddressDetailsTest.

@Test
public void getPostalAddressDetailsTest() {
    FluxLocationEntity fluxLocationEntity = getFluxLocationEntityMock();
    List<AddressDetailsDTO> fluxLocationDTO = FluxLocationMapper.INSTANCE.getPostalAddressDetails(fluxLocationEntity.getStructuredAddresses());
    assertNotNull(fluxLocationDTO);
    assertTrue(fluxLocationDTO.size() > 0);
}
Also used : AddressDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.details.AddressDetailsDTO) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) Test(org.junit.Test)

Aggregations

FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)4 AddressDetailsDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.details.AddressDetailsDTO)4 Test (org.junit.Test)4 StructuredAddressEntity (eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity)2 StructuredAddressTypeEnum (eu.europa.ec.fisheries.ers.fa.utils.StructuredAddressTypeEnum)2 StructuredAddress (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.StructuredAddress)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1