use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PeriodicMeterReadsGas in project open-smart-grid-platform by OSGP.
the class PeriodicMeterReadsContainerGasMappingTest method testWithFilledList.
/**
* Tests if mapping a PeriodicMeterReadsContainerGas object with a filled List and Set succeeds.
*/
@Test
public void testWithFilledList() {
// build test data
final OsgpMeterValue osgpMeterValue = new OsgpMeterValue(VALUE, OSGP_UNIT);
final Set<AmrProfileStatusCodeFlag> flagSet = new TreeSet<>();
flagSet.add(AMRCODEFLAG);
final AmrProfileStatusCode amrProfileStatusCode = new AmrProfileStatusCode(flagSet);
final PeriodicMeterReadsGas periodicMeterReadsGas = new PeriodicMeterReadsGas(DATE, osgpMeterValue, DATE, amrProfileStatusCode);
final List<PeriodicMeterReadsGas> periodicMeterReadsList = new ArrayList<>();
periodicMeterReadsList.add(periodicMeterReadsGas);
final PeriodicMeterReadsContainerGas periodicMeterReadsContainer = new PeriodicMeterReadsContainerGas(PERIODTYPE, periodicMeterReadsList);
// actual mapping
final PeriodicMeterReadsGasResponse periodicMeterReadsResponseGas = this.monitoringMapper.map(periodicMeterReadsContainer, PeriodicMeterReadsGasResponse.class);
// check mapping
assertThat(periodicMeterReadsResponseGas).isNotNull();
assertThat(periodicMeterReadsResponseGas.getPeriodicMeterReadsGas()).isNotNull();
assertThat(periodicMeterReadsResponseGas.getPeriodicMeterReadsGas().get(0)).isNotNull();
assertThat(periodicMeterReadsResponseGas.getPeriodicMeterReadsGas().get(0).getAmrProfileStatusCode()).isNotNull();
assertThat(periodicMeterReadsResponseGas.getPeriodicMeterReadsGas().get(0).getAmrProfileStatusCode().getAmrProfileStatusCodeFlag()).isNotNull();
assertThat(periodicMeterReadsResponseGas.getPeriodicMeterReadsGas().get(0).getAmrProfileStatusCode().getAmrProfileStatusCodeFlag().get(0)).isNotNull();
assertThat(periodicMeterReadsResponseGas.getPeriodicMeterReadsGas().get(0).getConsumption()).isNotNull();
assertThat(periodicMeterReadsResponseGas.getPeriodicMeterReadsGas().get(0).getConsumption().getUnit()).isNotNull();
assertThat(periodicMeterReadsResponseGas.getPeriodicMeterReadsGas().get(0).getConsumption().getValue()).isNotNull();
assertThat(periodicMeterReadsResponseGas.getPeriodType().name()).isEqualTo(PERIODTYPE.name());
assertThat(periodicMeterReadsResponseGas.getPeriodicMeterReadsGas().size()).isEqualTo(periodicMeterReadsList.size());
assertThat(periodicMeterReadsResponseGas.getPeriodicMeterReadsGas().get(0).getConsumption().getValue()).isEqualTo(VALUE);
assertThat(periodicMeterReadsResponseGas.getPeriodicMeterReadsGas().get(0).getConsumption().getUnit()).isEqualTo(OSGP_UNITTYPE);
assertThat(periodicMeterReadsResponseGas.getPeriodicMeterReadsGas().get(0).getAmrProfileStatusCode().getAmrProfileStatusCodeFlag().get(0).name()).isEqualTo(AMRCODEFLAG.name());
// For more information on the mapping of Date to XmlGregorianCalendar
// objects, refer to the DateMappingTest
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PeriodicMeterReadsGas in project open-smart-grid-platform by OSGP.
the class PeriodicMeterReadsContainerGasMappingTest method testWithEmptyList.
/**
* Tests if mapping a PeriodicMeterReadsContainerGas object with an empty list succeeds.
*/
@Test
public void testWithEmptyList() {
// build test data
final List<PeriodicMeterReadsGas> periodicMeterReadsGasList = new ArrayList<>();
final PeriodicMeterReadsContainerGas periodicMeterReadsContainerGas = new PeriodicMeterReadsContainerGas(PERIODTYPE, periodicMeterReadsGasList);
// actual mapping
final PeriodicMeterReadsGasResponse periodicMeterReadsGasResponse = this.monitoringMapper.map(periodicMeterReadsContainerGas, PeriodicMeterReadsGasResponse.class);
// check mapping
assertThat(periodicMeterReadsGasResponse).isNotNull();
assertThat(periodicMeterReadsGasResponse.getPeriodicMeterReadsGas()).isNotNull();
assertThat(periodicMeterReadsGasResponse.getPeriodType()).isNotNull();
assertThat(periodicMeterReadsGasResponse.getPeriodicMeterReadsGas().isEmpty()).isTrue();
assertThat(periodicMeterReadsGasResponse.getPeriodType().name()).isEqualTo(PERIODTYPE.name());
}
Aggregations