Search in sources :

Example 1 with FishingActivityCalculatedDateComparator

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);
}
Also used : FishingActivityCalculatedDateComparator(eu.europa.ec.fisheries.ers.service.facatch.evolution.FishingActivityCalculatedDateComparator) Date(java.util.Date) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Aggregations

FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 FishingActivityCalculatedDateComparator (eu.europa.ec.fisheries.ers.service.facatch.evolution.FishingActivityCalculatedDateComparator)1 Date (java.util.Date)1 Test (org.junit.Test)1