use of org.opensmartgridplatform.dto.valueobjects.smartmetering.AlarmTypeDto in project open-smart-grid-platform by OSGP.
the class SetAlarmNotificationsCommandExecutorTest method testSetSettingEnabledRegister.
@ParameterizedTest
@CsvSource({ "1,VOLTAGE_SAG_IN_PHASE_DETECTED_L1", "2,VOLTAGE_SAG_IN_PHASE_DETECTED_L2", "4,VOLTAGE_SAG_IN_PHASE_DETECTED_L3", "8,VOLTAGE_SWELL_IN_PHASE_DETECTED_L1", "16,VOLTAGE_SWELL_IN_PHASE_DETECTED_L2", "32,VOLTAGE_SWELL_IN_PHASE_DETECTED_L3", "3,VOLTAGE_SAG_IN_PHASE_DETECTED_L1;VOLTAGE_SAG_IN_PHASE_DETECTED_L2", "7,VOLTAGE_SAG_IN_PHASE_DETECTED_L1;VOLTAGE_SAG_IN_PHASE_DETECTED_L2;VOLTAGE_SAG_IN_PHASE_DETECTED_L3" })
void testSetSettingEnabledRegister(final long expectedValue, final String alarmTypesInput) throws OsgpException {
final List<AlarmTypeDto> alarmTypes = Arrays.stream(alarmTypesInput.split(";")).map(AlarmTypeDto::valueOf).collect(toList());
final AccessResultCode res = this.execute(alarmTypes.stream().map(alarmType -> new AlarmNotificationDto(alarmType, true)).toArray(AlarmNotificationDto[]::new));
assertThat(res).isEqualTo(AccessResultCode.SUCCESS);
assertThat(this.setParametersReceived.size()).isEqualTo(1);
assertThat((long) this.setParametersReceived.get(0).getData().getValue()).isEqualTo(expectedValue);
}
Aggregations