use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequest in project open-smart-grid-platform by OSGP.
the class SetSpecialDaysRequestMappingTest method testSpecialDaysRequestMappingEmptyList.
/**
* Tests mapping of a SetSpecialDaysRequest, when its SpecialDaysRequestData object has an empty
* List.
*/
@Test
public void testSpecialDaysRequestMappingEmptyList() {
// build test data
// No-arg constructor for SpecialDaysRequestData takes care of creating
// a empty List.
final SpecialDaysRequestData specialDaysRequestData = new SpecialDaysRequestData();
final SetSpecialDaysRequest setSpecialDaysRequest = new SetSpecialDaysRequest();
setSpecialDaysRequest.setDeviceIdentification(DEVICE_ID);
setSpecialDaysRequest.setSpecialDaysRequestData(specialDaysRequestData);
// actual mapping
final SpecialDaysRequest specialDaysRequest = this.configurationMapper.map(setSpecialDaysRequest, SpecialDaysRequest.class);
// check mapping
assertThat(specialDaysRequest).isNotNull();
assertThat(specialDaysRequest.getDeviceIdentification()).isNotNull();
assertThat(specialDaysRequest.getSpecialDaysRequestData()).isNotNull();
assertThat(specialDaysRequest.getSpecialDaysRequestData().getSpecialDays()).isNotNull();
assertThat(specialDaysRequest.getDeviceIdentification()).isEqualTo(DEVICE_ID);
assertThat(specialDaysRequest.getSpecialDaysRequestData().getSpecialDays().isEmpty()).isTrue();
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequest in project open-smart-grid-platform by OSGP.
the class SpecialDaysRequestMappingTest method testSpecialDaysRequestMappingEmptyList.
// To check mapping of SpecialDaysRequest, when its SpecialDaysRequestData
// has an empty List.
@Test
public void testSpecialDaysRequestMappingEmptyList() {
final String deviceIdentification = "nr1";
final SpecialDaysRequestData specialDaysRequestData = new SpecialDaysRequestDataBuilder().build();
final SpecialDaysRequest specialDaysRequestValueObject = new SpecialDaysRequest(deviceIdentification, specialDaysRequestData);
final SpecialDaysRequestDto specialDaysRequestDto = this.configurationMapper.map(specialDaysRequestValueObject, SpecialDaysRequestDto.class);
assertThat(specialDaysRequestDto.getDeviceIdentification()).isEqualTo(deviceIdentification);
assertThat(specialDaysRequestDto.getSpecialDaysRequestData()).isNotNull();
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequest in project open-smart-grid-platform by OSGP.
the class SpecialDaysRequestMappingTest method testSpecialDaysRequestMappingNull.
// To check mapping of SpecialDaysRequest, when its SpecialDaysRequestData
// is null
@Test
public void testSpecialDaysRequestMappingNull() {
final String deviceIdentification = "nr1";
final SpecialDaysRequestData specialDaysRequestData = null;
final SpecialDaysRequest specialDaysRequestValueObject = new SpecialDaysRequest(deviceIdentification, specialDaysRequestData);
final SpecialDaysRequestDto specialDaysRequestDto = this.configurationMapper.map(specialDaysRequestValueObject, SpecialDaysRequestDto.class);
assertThat(specialDaysRequestDto).isNotNull();
assertThat(specialDaysRequestDto.getDeviceIdentification()).isEqualTo(deviceIdentification);
assertThat(specialDaysRequestDto.getSpecialDaysRequestData()).isNull();
}
Aggregations