Search in sources :

Example 1 with FaReportCorrectionDTO

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());
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FaReportCorrectionDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.FaReportCorrectionDTO) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 2 with FaReportCorrectionDTO

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());
}
Also used : FluxReportIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity) FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FaReportCorrectionDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.FaReportCorrectionDTO) Test(org.junit.Test)

Example 3 with FaReportCorrectionDTO

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());
}
Also used : FluxReportIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity) FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FaReportCorrectionDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.FaReportCorrectionDTO) Test(org.junit.Test)

Aggregations

FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)3 FaReportCorrectionDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.FaReportCorrectionDTO)3 Test (org.junit.Test)3 FluxReportIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity)2 SneakyThrows (lombok.SneakyThrows)1