use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ConfigurationFlag in project open-smart-grid-platform by OSGP.
the class SetConfigurationObjectRequestMappingTest method testSetConfigurationObjectRequestMappingComplete.
// Tests if mapping with a complete SetConfigurationObjectRequestData object
// succeeds
@Test
public void testSetConfigurationObjectRequestMappingComplete() {
// build test data
final String deviceIdentification = "nr1";
final GprsOperationModeType gprsOperationModeType = GprsOperationModeType.ALWAYS_ON;
final ConfigurationFlagType configurationFlagType = ConfigurationFlagType.DISCOVER_ON_OPEN_COVER;
final ConfigurationFlag configurationFlag = new ConfigurationFlag(configurationFlagType, true);
final List<ConfigurationFlag> configurationFlagList = new ArrayList<>();
configurationFlagList.add(configurationFlag);
final ConfigurationFlags configurationFlags = new ConfigurationFlags(configurationFlagList);
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);
this.checkSetConfigurationObjectRequestData(gprsOperationModeType, configurationFlagType, configurationFlags, setConfigurationObjectRequestDto);
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ConfigurationFlag in project open-smart-grid-platform by OSGP.
the class GetConfigurationObjectResponseMappingTest method testMapConfigurationFlagDto.
@Test
public void testMapConfigurationFlagDto() {
final ConfigurationFlagDto dto = this.makeConfigurationFlagDto();
final ConfigurationFlag result = this.mapper.map(dto, ConfigurationFlag.class);
assertThat(result).withFailMessage("mapping ConfigurationFlagDto should not return null").isNotNull();
assertThat(result).withFailMessage("mapping ConfigurationFlagDto should return correct type").isOfAnyClassIn(ConfigurationFlag.class);
}
Aggregations