SetConfigurationObjectServiceDsmr4 extends SetConfigurationObjectService { @Override DataObject buildSetParameterData(final ConfigurationObjectDto configurationToSet, final ConfigurationObjectDto configurationOnDevice) throws ProtocolAdapterException { final List<DataObject> dataObjects = new LinkedList<>(); this.addGprsOperationMode(configurationToSet, configurationOnDevice, dataObjects); this.addFlags(configurationToSet, configurationOnDevice, dataObjects); return DataObject.newStructureData(dataObjects); } SetConfigurationObjectServiceDsmr4(final DlmsHelper dlmsHelper); @Override boolean handles(final Protocol protocol);  }
@Test public void buildSetParameterDataGprsModeToSet() throws ProtocolAdapterException { when(this.configurationToSet.getGprsOperationMode()).thenReturn(GPRS_OPERATION_MODE); when(this.configurationOnDevice.getGprsOperationMode()).thenReturn(null); final DataObject result = this.instance.buildSetParameterData(this.configurationToSet, this.configurationOnDevice); final List<DataObject> elements = result.getValue(); final int value = elements.get(0).getValue(); assertThat(value).isEqualTo(GPRS_OPERATION_MODE.getNumber()); }
@Test public void buildSetParameterDataGprsModeOnDevice() throws ProtocolAdapterException { when(this.configurationToSet.getGprsOperationMode()).thenReturn(null); when(this.configurationOnDevice.getGprsOperationMode()).thenReturn(GPRS_OPERATION_MODE); final DataObject result = this.instance.buildSetParameterData(this.configurationToSet, this.configurationOnDevice); final List<DataObject> elements = result.getValue(); final int value = elements.get(0).getValue(); assertThat(value).isEqualTo(GPRS_OPERATION_MODE.getNumber()); }