use of eu.europa.ec.fisheries.ers.service.dto.fareport.FaReportCorrectionDTO 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 eu.europa.ec.fisheries.ers.service.dto.fareport.FaReportCorrectionDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class FaReportDocumentMapperTest method testMapToFaReportCorrection.
@Test
public void testMapToFaReportCorrection() {
FaReportDocumentEntity faReportDocumentEntity = MapperUtil.getFaReportDocumentEntity();
FaReportCorrectionDTO faReportCorrectionDTO = FaReportDocumentMapper.INSTANCE.mapToFaReportCorrectionDto(faReportDocumentEntity);
assertEquals(faReportDocumentEntity.getStatus(), faReportCorrectionDTO.getCorrectionType());
assertEquals(faReportDocumentEntity.getFluxReportDocument().getCreationDatetime(), faReportCorrectionDTO.getCreationDate());
FluxReportIdentifierEntity entity = faReportDocumentEntity.getFluxReportDocument().getFluxReportIdentifiers().iterator().next();
assertEquals(entity.getFluxReportIdentifierId(), faReportCorrectionDTO.getFaReportIdentifiers().entrySet().iterator().next().getKey());
assertEquals(entity.getFluxReportIdentifierSchemeId(), faReportCorrectionDTO.getFaReportIdentifiers().entrySet().iterator().next().getValue());
assertEquals(faReportDocumentEntity.getFluxReportDocument().getFluxParty().getFluxPartyName(), faReportCorrectionDTO.getOwnerFluxPartyName());
}
use of eu.europa.ec.fisheries.ers.service.dto.fareport.FaReportCorrectionDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class FaReportDocumentMapperTest method testMapToFaReportCorrectionList.
@Test
public void testMapToFaReportCorrectionList() {
FaReportDocumentEntity faReportDocumentEntity = MapperUtil.getFaReportDocumentEntity();
List<FaReportCorrectionDTO> faReportCorrectionDTOs = FaReportDocumentMapper.INSTANCE.mapToFaReportCorrectionDtoList(Arrays.asList(faReportDocumentEntity));
FaReportCorrectionDTO faReportCorrectionDTO = faReportCorrectionDTOs.get(0);
assertEquals(faReportDocumentEntity.getStatus(), faReportCorrectionDTO.getCorrectionType());
assertEquals(faReportDocumentEntity.getFluxReportDocument().getCreationDatetime(), faReportCorrectionDTO.getCreationDate());
FluxReportIdentifierEntity entity = faReportDocumentEntity.getFluxReportDocument().getFluxReportIdentifiers().iterator().next();
assertEquals(entity.getFluxReportIdentifierId(), faReportCorrectionDTO.getFaReportIdentifiers().entrySet().iterator().next().getKey());
assertEquals(entity.getFluxReportIdentifierSchemeId(), faReportCorrectionDTO.getFaReportIdentifiers().entrySet().iterator().next().getValue());
assertEquals(faReportDocumentEntity.getFluxReportDocument().getFluxParty().getFluxPartyName(), faReportCorrectionDTO.getOwnerFluxPartyName());
}
Aggregations