AlarmHelperService { public Set<AlarmTypeDto> toAlarmTypes(final Number registerValue) { return BYTE_REGISTER_CONVERTER.toTypes(registerValue.longValue()); }  Map<AlarmTypeDto, Integer> getAlarmRegisterBitIndexPerAlarmType(); Integer toBitPosition(final AlarmTypeDto alarmType); Set<AlarmTypeDto> toAlarmTypes(final Number registerValue); Long toLongValue(final Set<AlarmTypeDto> alarmTypes);  }
@Test public void testConvertToAlarmTypes() { final long registerValue = Long.parseLong("00000001000100010001000100000001", 2); final Set<AlarmTypeDto> alarmTypes = this.alarmHelperService.toAlarmTypes(registerValue); assertThat(alarmTypes.contains(AlarmTypeDto.CLOCK_INVALID)).isTrue(); assertThat(alarmTypes.contains(AlarmTypeDto.PROGRAM_MEMORY_ERROR)).isTrue(); assertThat(alarmTypes.contains(AlarmTypeDto.WATCHDOG_ERROR)).isTrue(); assertThat(alarmTypes.contains(AlarmTypeDto.COMMUNICATION_ERROR_M_BUS_CHANNEL_1)).isTrue(); assertThat(alarmTypes.contains(AlarmTypeDto.FRAUD_ATTEMPT_M_BUS_CHANNEL_1)).isTrue(); assertThat(alarmTypes.contains(AlarmTypeDto.NEW_M_BUS_DEVICE_DISCOVERED_CHANNEL_1)).isTrue(); }