JsonSensitivityAnalysisParameters { public static SensitivityAnalysisParameters update(SensitivityAnalysisParameters parameters, Path jsonFile) { Objects.requireNonNull(jsonFile); try (InputStream is = Files.newInputStream(jsonFile)) { return update(parameters, is); } catch (IOException e) { throw new UncheckedIOException(e); } } private  JsonSensitivityAnalysisParameters(); static ExtensionProviders<ExtensionSerializer> getExtensionSerializers(); static SensitivityAnalysisParameters read(Path jsonFile); static SensitivityAnalysisParameters read(InputStream jsonStream); static SensitivityAnalysisParameters update(SensitivityAnalysisParameters parameters, Path jsonFile); static SensitivityAnalysisParameters update(SensitivityAnalysisParameters parameters, InputStream jsonStream); static void write(SensitivityAnalysisParameters parameters, Path jsonFile); static void write(SensitivityAnalysisParameters parameters, OutputStream outputStream); static SensitivityAnalysisParameters deserialize(JsonParser parser, DeserializationContext context, SensitivityAnalysisParameters parameters); static SensitivityAnalysisParameters deserialize(JsonParser parser, DeserializationContext context); static void serialize(SensitivityAnalysisParameters parameters, JsonGenerator jsonGenerator, SerializerProvider serializerProvider);  }
@Test public void updateLoadFlowParameters() { SensitivityAnalysisParameters parameters = new SensitivityAnalysisParameters(); parameters.getLoadFlowParameters().setTwtSplitShuntAdmittance(true); JsonSensitivityAnalysisParameters.update(parameters, getClass().getResourceAsStream("/SensitivityAnalysisParametersIncomplete.json")); assertTrue(parameters.getLoadFlowParameters().isTwtSplitShuntAdmittance()); }
@Test public void updateExtensions() { SensitivityAnalysisParameters parameters = new SensitivityAnalysisParameters(); DummyExtension extension = new DummyExtension(); extension.setParameterBoolean(false); extension.setParameterString("test"); extension.setParameterDouble(2.8); DummyExtension oldExtension = new DummyExtension(extension); parameters.addExtension(DummyExtension.class, extension); JsonSensitivityAnalysisParameters.update(parameters, getClass().getResourceAsStream("/SensitivityAnalysisParametersExtensionUpdate.json")); DummyExtension updatedExtension = parameters.getExtension(DummyExtension.class); assertEquals(oldExtension.isParameterBoolean(), updatedExtension.isParameterBoolean()); assertEquals(oldExtension.getParameterDouble(), updatedExtension.getParameterDouble(), 0.01); assertNotEquals(oldExtension.getParameterString(), updatedExtension.getParameterString()); }