Search in sources :

Example 1 with ProcessingProductsDto

use of eu.europa.ec.fisheries.ers.service.dto.view.ProcessingProductsDto in project UVMS-ActivityModule-APP by UnionVMS.

the class AapProductMapperTest method testMapToProcessingProduct.

@Test
public void testMapToProcessingProduct() {
    // Prepare
    FACatch faCatch = MapperUtil.getFaCatch();
    FaCatchEntity faCatchEntity = new FaCatchEntity();
    FaCatchMapper.INSTANCE.mapToFaCatchEntity(faCatch);
    AAPProcess aapProcess = MapperUtil.getAapProcess();
    AapProcessEntity aapProcessEntity = AapProcessMapper.INSTANCE.mapToAapProcessEntity(aapProcess);
    aapProcessEntity.setFaCatch(faCatchEntity);
    AAPProduct aapProduct = MapperUtil.getAapProduct();
    AapProductEntity aapProductEntity = AapProductMapper.INSTANCE.mapToAapProductEntity(aapProduct);
    aapProductEntity.setAapProcess(aapProcessEntity);
    // Create Input data
    ProcessingProductsDto processingProductsDto = AapProductMapper.INSTANCE.mapToProcessingProduct(aapProductEntity);
    assertEquals(processingProductsDto.getType(), faCatchEntity.getTypeCode());
    assertEquals(processingProductsDto.getGear(), faCatchEntity.getGearTypeCode());
    assertEquals(processingProductsDto.getSpecies(), faCatchEntity.getSpeciesCode());
    assertNull(processingProductsDto.getPreservation());
    assertNull(processingProductsDto.getPresentation());
    assertNull(processingProductsDto.getFreshness());
    assertEquals(processingProductsDto.getConversionFactor(), aapProcessEntity.getConversionFactor().doubleValue());
    assertEquals(processingProductsDto.getWeight(), aapProductEntity.getCalculatedWeightMeasure());
    assertEquals(processingProductsDto.getQuantity(), aapProductEntity.getUnitQuantity());
    assertEquals(processingProductsDto.getPackageWeight(), aapProductEntity.getPackagingUnitAvarageWeight());
    assertEquals(processingProductsDto.getPackageQuantity().doubleValue(), aapProductEntity.getPackagingUnitCount().doubleValue());
    assertEquals(processingProductsDto.getPackagingType(), aapProductEntity.getPackagingTypeCode());
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) AAPProduct(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProduct) AAPProcess(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProcess) ProcessingProductsDto(eu.europa.ec.fisheries.ers.service.dto.view.ProcessingProductsDto) AapProcessEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity) FACatch(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch) AapProductEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProductEntity) Test(org.junit.Test)

Aggregations

AapProcessEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity)1 AapProductEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProductEntity)1 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)1 ProcessingProductsDto (eu.europa.ec.fisheries.ers.service.dto.view.ProcessingProductsDto)1 Test (org.junit.Test)1 AAPProcess (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProcess)1 AAPProduct (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProduct)1 FACatch (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch)1