Search in sources :

Example 16 with FishingTripIdentifierEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingTripServiceBeanTest method getPreviousTrips.

public List<FishingTripIdentifierEntity> getPreviousTrips(int numberOfRecord) {
    List<FishingTripIdentifierEntity> previousTrips = new ArrayList<>();
    for (int i = 1; i <= numberOfRecord; i++) {
        FishingTripIdentifierEntity identifier = new FishingTripIdentifierEntity();
        identifier.setTripId("Previous Trip " + i);
        identifier.setTripSchemeId("Previous Scheme " + i);
        previousTrips.add(identifier);
    }
    return previousTrips;
}
Also used : ArrayList(java.util.ArrayList) FishingTripIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)

Example 17 with FishingTripIdentifierEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingTripServiceBeanTest method getNextTrips.

public List<FishingTripIdentifierEntity> getNextTrips(int numberOfRecord) {
    List<FishingTripIdentifierEntity> nextTrips = new ArrayList<>();
    for (int i = 1; i <= numberOfRecord; i++) {
        FishingTripIdentifierEntity identifier = new FishingTripIdentifierEntity();
        identifier.setTripId("Next Trip " + i);
        identifier.setTripSchemeId("Next Scheme " + i);
        nextTrips.add(identifier);
    }
    return nextTrips;
}
Also used : ArrayList(java.util.ArrayList) FishingTripIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)

Example 18 with FishingTripIdentifierEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingTripServiceBeanTest method getCronologyOfFishingTrip_limitedRecordsFound.

@Test
@SneakyThrows
public void getCronologyOfFishingTrip_limitedRecordsFound() {
    // Mock the Dao
    doReturn(getVesselIdentifiers()).when(vesselIdentifiersDao).getLatestVesselIdByTrip(any(String.class));
    FishingTripIdentifierEntity fishingTripIdentifierEntity = getCurrentTrip();
    doReturn(fishingTripIdentifierEntity).when(fishingTripIdentifierDao).getCurrentTrip(any(String.class), any(String.class));
    List<FishingTripIdentifierEntity> previousTrips = getPreviousTrips(5);
    doReturn(previousTrips).when(fishingTripIdentifierDao).getPreviousTrips(any(String.class), any(String.class), any(String.class), any(Integer.class));
    List<FishingTripIdentifierEntity> nextTrips = getNextTrips(5);
    doReturn(nextTrips).when(fishingTripIdentifierDao).getNextTrips(any(String.class), any(String.class), any(String.class), any(Integer.class));
    // Trigger
    String selectedTrip = "selected Trip";
    CronologyTripDTO cronology = fishingTripService.getCronologyOfFishingTrip(selectedTrip, 5);
    // Assert
    assertEquals(selectedTrip, cronology.getSelectedTrip());
    assertEquals(fishingTripIdentifierEntity.getTripId(), cronology.getCurrentTrip());
    List<String> previousIds = getIds(previousTrips);
    assertEquals(previousIds.subList(3, previousIds.size()), cronology.getPreviousTrips());
    List<String> nextIds = getIds(nextTrips);
    assertEquals(nextIds.subList(0, 2), cronology.getNextTrips());
}
Also used : FishingTripIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity) CronologyTripDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CronologyTripDTO) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Aggregations

FishingTripIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)18 ArrayList (java.util.ArrayList)5 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)4 CronologyTripDTO (eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CronologyTripDTO)4 SneakyThrows (lombok.SneakyThrows)4 Test (org.junit.Test)4 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)3 VesselIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity)3 HashSet (java.util.HashSet)3 LinkedHashSet (java.util.LinkedHashSet)3 VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)2 TripOverviewDto (eu.europa.ec.fisheries.ers.service.dto.view.TripOverviewDto)2 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)2 ParseException (com.vividsolutions.jts.io.ParseException)1 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)1 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)1 FishingActivityIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity)1 FluxReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)1 SizeDistributionEntity (eu.europa.ec.fisheries.ers.fa.entities.SizeDistributionEntity)1 FishingActivityTypeDTO (eu.europa.ec.fisheries.ers.service.dto.fishingtrip.FishingActivityTypeDTO)1