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;
}
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;
}
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());
}
Aggregations