use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class TripCatchEvolutionTest method testFishingActivityCalculatedDateComparator.
@Test
public void testFishingActivityCalculatedDateComparator() {
FishingActivityEntity fishingActivityEntity1 = new FishingActivityEntity();
fishingActivityEntity1.setCalculatedStartTime(new Date(1000002));
FishingActivityEntity fishingActivityEntity2 = new FishingActivityEntity();
fishingActivityEntity2.setCalculatedStartTime(new Date(1000000));
FishingActivityEntity fishingActivityEntity3 = new FishingActivityEntity();
fishingActivityEntity3.setCalculatedStartTime(new Date(1000001));
FishingActivityEntity fishingActivityEntity4 = new FishingActivityEntity();
fishingActivityEntity4.setCalculatedStartTime(null);
List<FishingActivityEntity> fishingActivities = Arrays.asList(fishingActivityEntity1, fishingActivityEntity2, fishingActivityEntity3, fishingActivityEntity4);
Collections.sort(fishingActivities, new FishingActivityCalculatedDateComparator());
Assert.assertEquals(fishingActivities.get(0).getCalculatedStartTime().getTime(), fishingActivityEntity2.getCalculatedStartTime().getTime());
Assert.assertEquals(fishingActivities.get(2).getCalculatedStartTime().getTime(), fishingActivityEntity1.getCalculatedStartTime().getTime());
Assert.assertEquals(fishingActivities.get(3).getCalculatedStartTime(), null);
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FaReportDocumentMapperTest method testFaReportDocumentMapperNullReturns.
@Test
public void testFaReportDocumentMapperNullReturns() {
Set<FishingActivityEntity> fishingActivityEntities = FaReportDocumentMapper.INSTANCE.getFishingActivityEntities(null, new FaReportDocumentEntity());
assertTrue(fishingActivityEntities.size() == 0);
Set<VesselTransportMeansEntity> vesselTransportMeansEntityList = FaReportDocumentMapper.INSTANCE.getVesselTransportMeansEntity(null, new FaReportDocumentEntity());
assertNull(vesselTransportMeansEntityList);
Set<FishingActivityEntity> fishingActivityEntities1 = FaReportDocumentMapper.INSTANCE.getFishingActivityEntities(null, new FaReportDocumentEntity());
assertTrue(fishingActivityEntities1.size() == 0);
Set<FaReportIdentifierEntity> faReportIdentifierEntities = FaReportDocumentMapper.INSTANCE.mapToFAReportIdentifierEntities(null, new FaReportDocumentEntity());
assertTrue(faReportIdentifierEntities.size() == 0);
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityMapperTest method testSpeciesCodeWithNullShouldNotBeMapped.
@Test
public void testSpeciesCodeWithNullShouldNotBeMapped() {
FaCatchEntity faCatchEntity = new FaCatchEntity();
faCatchEntity.setSpeciesCode(null);
FishingActivityEntity fa = FishingActivityEntity.builder().build();
fa.setFaCatchs(newSet(faCatchEntity));
List<String> speciesCode = FishingActivityMapper.INSTANCE.getSpeciesCode(fa);
assertEquals(0, speciesCode.size());
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityMapperTest method testSpeciesCodeWithDuplicatedShouldFilterDuplicates.
@Test
public void testSpeciesCodeWithDuplicatedShouldFilterDuplicates() {
FaCatchEntity faCatchEntity = new FaCatchEntity();
faCatchEntity.setSpeciesCode("2222");
AapProductEntity aapProductEntity = new AapProductEntity();
aapProductEntity.setSpeciesCode("2222");
AapProcessEntity aapProcessEntity = new AapProcessEntity();
aapProcessEntity.setAapProducts(newSet(aapProductEntity));
faCatchEntity.setAapProcesses(newSet(aapProcessEntity));
FishingActivityEntity fa = FishingActivityEntity.builder().build();
fa.setFaCatchs(newSet(faCatchEntity));
List<String> speciesCode = FishingActivityMapper.INSTANCE.getSpeciesCode(fa);
assertEquals(1, speciesCode.size());
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityViewMapperTest method testActivityRelocationViewMapper.
@Test
@SneakyThrows
public void testActivityRelocationViewMapper() {
BaseActivityViewMapper mapperForView = ActivityViewMapperFactory.getMapperForView(ActivityViewEnum.RELOCATION);
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));
}
Aggregations