use of org.opensmartgridplatform.dto.da.measurements.MeasurementGroupDto in project open-smart-grid-platform by OSGP.
the class DomainDistributionAutomationMapperTest method testMeasurementGroupMapping.
@Test
public void testMeasurementGroupMapping() {
// Arrange
final String groupIdentification = "215";
final float[] gasFlowMeasurements = { 401.70001f, 88.575f };
final MeasurementGroup expected = DomainMeasurementsFactory.gasFlowMeasurementGroup(groupIdentification, gasFlowMeasurements);
final MeasurementGroupDto dtoMeasurementGroup = DtoMeasurementsFactory.gasFlowMeasurementGroup(groupIdentification, gasFlowMeasurements);
// Act
final MeasurementGroup actual = this.mapper.map(dtoMeasurementGroup, MeasurementGroup.class);
// Assert
assertThat(actual).isEqualTo(expected);
}
use of org.opensmartgridplatform.dto.da.measurements.MeasurementGroupDto in project open-smart-grid-platform by OSGP.
the class DomainDistributionAutomationMapperTest method testMeasurementReportMapping.
@Test
public void testMeasurementReportMapping() {
// Arrange
final int commonAddress = 55;
final String groupIdentification = "137";
final float[] gasFlowMeasurements = { 78.733f, 21.000f };
// Arrange domain
final MeasurementGroup expectedGroup = DomainMeasurementsFactory.gasFlowMeasurementGroup(groupIdentification, gasFlowMeasurements);
final List<MeasurementGroup> expectedGroups = new ArrayList<>();
expectedGroups.add(expectedGroup);
final MeasurementReport expected = new MeasurementReport(DomainMeasurementsFactory.spontaneousReportHeader(commonAddress), expectedGroups);
// Arrange DTO
final MeasurementReportHeaderDto dtoHeader = DtoMeasurementsFactory.spontaneousReportHeader(commonAddress);
final MeasurementGroupDto dtoGroup = DtoMeasurementsFactory.gasFlowMeasurementGroup(groupIdentification, gasFlowMeasurements);
final List<MeasurementGroupDto> dtoGroups = new ArrayList<>();
dtoGroups.add(dtoGroup);
final MeasurementReportDto dtoReport = new MeasurementReportDto(dtoHeader, dtoGroups);
// Act
final MeasurementReport actual = this.mapper.map(dtoReport, MeasurementReport.class);
// Assert
assertThat(actual).isEqualTo(expected);
}
Aggregations