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());
}
Aggregations