Search in sources :

Example 11 with FishingGearEntity

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

the class GearCharacteristicsMapperTest method testMapGearDtoToFishingGearEntityWithTypeCodeDG.

@Test
@Parameters(method = "methodName")
public void testMapGearDtoToFishingGearEntityWithTypeCodeDG(GearCharacteristicEntity entity, String typeCode, GearDto expectedDto) {
    entity.setTypeCode(typeCode);
    FishingGearEntity build = FishingGearEntity.builder().gearCharacteristics(newSet(entity)).build();
    GearDto mappedDto = GearCharacteristicsMapper.INSTANCE.mapGearDtoToFishingGearEntity(build);
    assertTrue(expectedDto.equals(mappedDto));
}
Also used : FishingGearEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity) GearDto(eu.europa.ec.fisheries.ers.service.dto.view.GearDto) Parameters(junitparams.Parameters) Test(org.junit.Test)

Example 12 with FishingGearEntity

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

the class GearProblemMapperTest method testGearProblemMapper.

@Test
public void testGearProblemMapper() {
    GearProblem gearProblem = MapperUtil.getGearProblem();
    GearProblemEntity gearProblemEntity = GearProblemMapper.INSTANCE.mapToGearProblemEntity(gearProblem);
    assertEquals(gearProblem.getTypeCode().getValue(), gearProblemEntity.getTypeCode());
    assertEquals(gearProblem.getTypeCode().getListID(), gearProblemEntity.getTypeCodeListId());
    assertEquals(gearProblem.getAffectedQuantity().getValue().intValue(), gearProblemEntity.getAffectedQuantity());
    assertEquals(gearProblem.getRecoveryMeasureCodes().get(0).getValue(), gearProblemEntity.getGearProblemRecovery().iterator().next().getRecoveryMeasureCode());
    assertEquals(gearProblem.getRecoveryMeasureCodes().get(0).getListID(), gearProblemEntity.getGearProblemRecovery().iterator().next().getRecoveryMeasureCodeListId());
    assertNull(gearProblemEntity.getFishingActivity());
    assertNotNull(gearProblemEntity.getFishingGears());
    FishingGearEntity fishingGearEntity = gearProblemEntity.getFishingGears().iterator().next();
    assertEquals(gearProblem.getTypeCode().getValue(), fishingGearEntity.getGearProblem().getTypeCode());
    assertEquals(gearProblem.getTypeCode().getListID(), fishingGearEntity.getGearProblem().getTypeCodeListId());
    assertEquals(gearProblem.getAffectedQuantity().getValue().intValue(), fishingGearEntity.getGearProblem().getAffectedQuantity());
    assertEquals(gearProblem.getRecoveryMeasureCodes().get(0).getValue(), fishingGearEntity.getGearProblem().getGearProblemRecovery().iterator().next().getRecoveryMeasureCode());
    assertEquals(gearProblem.getRecoveryMeasureCodes().get(0).getListID(), fishingGearEntity.getGearProblem().getGearProblemRecovery().iterator().next().getRecoveryMeasureCodeListId());
    assertEquals(gearProblemEntity.getTypeCode(), "Code Type 1");
    assertEquals(gearProblemEntity.getTypeCodeListId(), "fhty58-gh586t-5tjf8-t58rjewe");
    gearProblemEntity.getLocations().iterator().next().onPrePersist();
    assertNotNull(gearProblemEntity.getLocations().iterator().next().getGeom());
}
Also used : GearProblem(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearProblem) GearProblemEntity(eu.europa.ec.fisheries.ers.fa.entities.GearProblemEntity) FishingGearEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity) Test(org.junit.Test)

Aggregations

FishingGearEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity)12 Test (org.junit.Test)7 FishingGear (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingGear)6 HashSet (java.util.HashSet)4 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)2 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)2 FluxCharacteristicEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity)2 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)2 GearDto (eu.europa.ec.fisheries.ers.service.dto.view.GearDto)2 AapProcessEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity)1 AapStockEntity (eu.europa.ec.fisheries.ers.fa.entities.AapStockEntity)1 DelimitedPeriodEntity (eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity)1 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 FishingActivityIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity)1 GearProblemEntity (eu.europa.ec.fisheries.ers.fa.entities.GearProblemEntity)1 ArrayList (java.util.ArrayList)1 Parameters (junitparams.Parameters)1 FACatch (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch)1 FishingActivity (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity)1 GearProblem (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearProblem)1