use of eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityViewMapperTest method testActivityDepartureViewMapper.
@Test
@SneakyThrows
public void testActivityDepartureViewMapper() {
BaseActivityViewMapper mapperForView = ActivityViewMapperFactory.getMapperForView(ActivityViewEnum.DEPARTURE);
FishingActivityEntity fishingActivityEntity = getFishingActivityEntity();
Set<FaCatchEntity> faCatches = generateFaCatches(fishingActivityEntity.getFaCatchs().iterator().next());
fishingActivityEntity.setFaCatchs(faCatches);
FishingActivityViewDTO fishingActivityViewDTO = mapperForView.mapFaEntityToFaDto(fishingActivityEntity);
assertNotNull(fishingActivityViewDTO.getActivityDetails());
assertNotNull(fishingActivityViewDTO.getReportDetails());
assertNull(ActivityArrivalViewMapper.INSTANCE.mapFaEntityToFaDto(null));
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityViewMapperTest method generateFaCatches.
@SneakyThrows
private Set<FaCatchEntity> generateFaCatches(FaCatchEntity faCatchExample) {
List<FaCatchEntity> faCatchList = new ArrayList<>();
FaCatchEntity clone_1 = (FaCatchEntity) BeanUtils.cloneBean(faCatchExample);
FaCatchEntity clone_2 = (FaCatchEntity) BeanUtils.cloneBean(faCatchExample);
FaCatchEntity clone_3 = (FaCatchEntity) BeanUtils.cloneBean(faCatchExample);
FaCatchEntity clone_4 = (FaCatchEntity) BeanUtils.cloneBean(faCatchExample);
faCatchList.add(cloneEntity(clone_1, "LSC", 100.00));
faCatchList.add(cloneEntity(clone_2, "LSC", 100.00));
faCatchList.add(cloneEntity(clone_3, "BMS", 200.00));
faCatchList.add(cloneEntity(clone_4, "BMS", 200.00));
return new HashSet<>(Arrays.asList(clone_1, clone_2, clone_3, clone_4));
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityViewMapperTest method testActivityLandingViewMapper.
@Test
@SneakyThrows
public void testActivityLandingViewMapper() {
BaseActivityViewMapper mapperForView = ActivityViewMapperFactory.getMapperForView(ActivityViewEnum.LANDING);
FishingActivityEntity fishingActivityEntity = getFishingActivityEntity();
Set<FaCatchEntity> faCatches = generateFaCatches(fishingActivityEntity.getFaCatchs().iterator().next());
fishingActivityEntity.setFaCatchs(faCatches);
FishingActivityViewDTO fishingActivityViewDTO = mapperForView.mapFaEntityToFaDto(fishingActivityEntity);
assertNotNull(fishingActivityViewDTO.getActivityDetails());
assertNotNull(fishingActivityViewDTO.getReportDetails());
assertNull(ActivityArrivalViewMapper.INSTANCE.mapFaEntityToFaDto(null));
// printDtoOnConsole(fishingActivityViewDTO, FishingActivityView.Landing.class);
}
Aggregations