use of org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDto in project open-smart-grid-platform by OSGP.
the class SetConfigurationObjectRequestMappingTest method testMappingWithEmptyList.
// Test if mapping with ConfigurationFlags with an empty list succeeds.
@Test
public void testMappingWithEmptyList() {
// build test data
final String deviceIdentification = "nr1";
final GprsOperationModeType gprsOperationModeType = GprsOperationModeType.ALWAYS_ON;
final ConfigurationFlags configurationFlags = new ConfigurationFlags(new ArrayList<>());
final ConfigurationObject configurationObject = new ConfigurationObject(gprsOperationModeType, configurationFlags);
final SetConfigurationObjectRequestData setConfigurationObjectRequestData = new SetConfigurationObjectRequestData(configurationObject);
// actual mapping
final SetConfigurationObjectRequest setConfigurationObjectRequest = new SetConfigurationObjectRequest(deviceIdentification, setConfigurationObjectRequestData);
final SetConfigurationObjectRequestDto setConfigurationObjectRequestDto = this.configurationMapper.map(setConfigurationObjectRequest, SetConfigurationObjectRequestDto.class);
// check values
assertThat(setConfigurationObjectRequestDto).isNotNull();
assertThat(setConfigurationObjectRequestDto.getDeviceIdentification()).isEqualTo(deviceIdentification);
final ConfigurationObjectDto configurationObjectDto = setConfigurationObjectRequestDto.getSetConfigurationObjectRequestData().getConfigurationObject();
assertThat(configurationObjectDto).isNotNull();
// Check if both configurationFlags instances have an empty list
assertThat(configurationObjectDto.getConfigurationFlags().getFlags()).isEmpty();
}
Aggregations