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