use of eu.europa.ec.fisheries.ers.service.facatch.evolution.FishingActivityCalculatedDateComparator 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);
}
Aggregations