use of lombok.SneakyThrows in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityViewMapperTest method testActivityArrivalViewMapper.
@Test
@SneakyThrows
public void testActivityArrivalViewMapper() {
BaseActivityViewMapper mapperForView = ActivityViewMapperFactory.getMapperForView(ActivityViewEnum.ARRIVAL);
FishingActivityViewDTO fishingActivityViewDTO = mapperForView.mapFaEntityToFaDto(getFishingActivityEntity());
assertNotNull(fishingActivityViewDTO.getActivityDetails());
assertNotNull(fishingActivityViewDTO.getGears());
assertNotNull(fishingActivityViewDTO.getReportDetails());
assertTrue(fishingActivityViewDTO.getGears().size() == 1);
assertNull(mapperForView.mapFaEntityToFaDto(null));
// printDtoOnConsole(fishingActivityViewDTO, FishingActivityView.Arrival.class);
}
use of lombok.SneakyThrows in project UVMS-ActivityModule-APP by UnionVMS.
the class FluxFaReportMessageMapperTest method testFluxFaReportMessageMapper.
@Test
@SneakyThrows
public void testFluxFaReportMessageMapper() {
InputStream is = this.getClass().getClassLoader().getResourceAsStream("fa_flux_message.xml");
JAXBContext jaxbContext = JAXBContext.newInstance(FLUXFAReportMessage.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
FLUXFAReportMessage fluxfaReportMessage = (FLUXFAReportMessage) jaxbUnmarshaller.unmarshal(is);
FluxFaReportMessageEntity fluxRepMessageEntity = FluxFaReportMessageMapper.INSTANCE.mapToFluxFaReportMessage(fluxfaReportMessage, FaReportSourceEnum.FLUX, new FluxFaReportMessageEntity());
List<FaReportDocumentEntity> faReportDocuments = new ArrayList(fluxRepMessageEntity.getFaReportDocuments());
FluxReportDocumentEntity fluxReportDocument = fluxRepMessageEntity.getFluxReportDocument();
assertNotNull(fluxRepMessageEntity);
assertNotNull(fluxReportDocument);
assertNotNull(fluxReportDocument.getFluxFaReportMessage());
assertNotNull(faReportDocuments.get(0).getFluxReportDocument());
assertEquals(1, faReportDocuments.size());
}
use of lombok.SneakyThrows in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityServiceBeanTest method testGetFaReportCorrections.
@Test
@SneakyThrows
public void testGetFaReportCorrections() throws ServiceException {
// Mock
FaReportDocumentEntity faReportDocumentEntity = MapperUtil.getFaReportDocumentEntity();
Mockito.doReturn(faReportDocumentEntity).when(faReportDocumentDao).findFaReportByIdAndScheme(Mockito.any(String.class), Mockito.any(String.class));
// Trigger
List<FaReportCorrectionDTO> faReportCorrectionDTOList = activityService.getFaReportCorrections("TEST ID", "SCHEME ID");
// Verify
Mockito.verify(faReportDocumentDao, Mockito.times(1)).findFaReportByIdAndScheme("TEST ID", "SCHEME ID");
// Test
FaReportCorrectionDTO faReportCorrectionDTO = faReportCorrectionDTOList.get(0);
assertEquals(faReportDocumentEntity.getStatus(), faReportCorrectionDTO.getCorrectionType());
assertEquals(faReportDocumentEntity.getFluxReportDocument().getCreationDatetime(), faReportCorrectionDTO.getCreationDate());
assertEquals(faReportDocumentEntity.getAcceptedDatetime(), faReportCorrectionDTO.getAcceptedDate());
assertEquals(faReportDocumentEntity.getFluxReportDocument().getFluxReportIdentifiers().iterator().next().getFluxReportIdentifierId(), faReportCorrectionDTO.getFaReportIdentifiers().entrySet().iterator().next().getKey());
assertEquals(faReportDocumentEntity.getFluxReportDocument().getFluxReportIdentifiers().iterator().next().getFluxReportIdentifierSchemeId(), faReportCorrectionDTO.getFaReportIdentifiers().entrySet().iterator().next().getValue());
assertEquals(faReportDocumentEntity.getFluxReportDocument().getFluxParty().getFluxPartyName(), faReportCorrectionDTO.getOwnerFluxPartyName());
}
use of lombok.SneakyThrows in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityServiceBeanTest method testGetVesselDetailsForFishingTrip.
@Test
@SneakyThrows
public void testGetVesselDetailsForFishingTrip() throws ServiceException {
Map<String, List<String>> returnMap = new HashMap<>();
returnMap.put("code", new ArrayList<String>());
when(vesselTransportMeansDao.findLatestVesselByTripId("NOR-TRP-20160517234053706")).thenReturn(new VesselTransportMeansEntity());
when(mdrModuleServiceBean.getAcronymFromMdr("FLUX_VESSEL_ID_TYPE", "*", new ArrayList<String>(), 9999999, "code")).thenReturn(returnMap);
// Trigger
VesselDetailsDTO vesselDetailsDTO = fishingTripService.getVesselDetailsForFishingTrip("NOR-TRP-20160517234053706");
Mockito.verify(vesselTransportMeansDao, Mockito.times(1)).findLatestVesselByTripId(Mockito.any(String.class));
// Verify
assertNotNull(vesselDetailsDTO);
}
use of lombok.SneakyThrows in project UVMS-ActivityModule-APP by UnionVMS.
the class FaReportDocumentDaoTest method testInsertTable.
@Test
@SneakyThrows
@Transactional
public void testInsertTable() throws Exception {
dbSetupTracker.skipNextLaunch();
List<FaReportDocumentEntity> faReportDocumentEntities = new ArrayList<>();
FAReportDocument faReportDocument = MapperUtil.getFaReportDocument();
FaReportDocumentEntity faReportDocumentEntity = FaReportDocumentMapper.INSTANCE.mapToFAReportDocumentEntity(faReportDocument, new FaReportDocumentEntity(), FaReportSourceEnum.FLUX);
faReportDocumentEntities.add(faReportDocumentEntity);
insertIntoDB(faReportDocumentEntities);
List<FaReportDocumentEntity> entityList = dao.findAllEntity(FaReportDocumentEntity.class);
assertNotNull(entityList);
assertNotEquals(0, entityList.size());
}
Aggregations