SetConfigurationObjectService implements ProtocolService { BitString getFlags(final ConfigurationObjectDto configurationToSet, final ConfigurationObjectDto configurationOnDevice) throws ProtocolAdapterException { final List<ConfigurationFlagDto> flagsToSet = new ArrayList<>(); this.addSettableFlags(configurationToSet, flagsToSet); this.addDeviceFlags(configurationOnDevice, flagsToSet); final byte[] flagBytesToSet = this.toBytes(flagsToSet); return new BitString(flagBytesToSet, NUMBER_OF_FLAG_BITS); } SetConfigurationObjectService(final DlmsHelper dlmsHelper); AccessResultCode setConfigurationObject(final DlmsConnectionManager conn,
            final ConfigurationObjectDto configurationToSet, final ConfigurationObjectDto configurationOnDevice);  }
@Test public void getFlagsCannotFindBitPosition() throws Exception { final ArrayList<ConfigurationFlagDto> flags = new ArrayList<>(); flags.add(new ConfigurationFlagDto(ConfigurationFlagTypeDto.PO_ENABLE, true)); final ConfigurationFlagsDto flagsToSet = new ConfigurationFlagsDto(flags); when(this.configurationToSet.getConfigurationFlags()).thenReturn(flagsToSet); when(this.configurationOnDevice.getConfigurationFlags()).thenReturn(this.emptyFlags()); assertThatExceptionOfType(ProtocolAdapterException.class).isThrownBy(() -> { this.instance.getFlags(this.configurationToSet, this.configurationOnDevice); }); }
@Test public void getFlagsNullConfigurationFlags() throws Exception { when(this.configurationToSet.getConfigurationFlags()).thenReturn(null); when(this.configurationOnDevice.getConfigurationFlags()).thenReturn(null); this.instance.getFlags(this.configurationToSet, this.configurationOnDevice); }