JsonLoadFlowParameters { public static LoadFlowParameters read(Path jsonFile) { return update(new LoadFlowParameters(), jsonFile); } private  JsonLoadFlowParameters(); static ExtensionProviders<ExtensionSerializer> getExtensionSerializers(); static LoadFlowParameters read(Path jsonFile); static LoadFlowParameters read(InputStream jsonStream); static LoadFlowParameters update(LoadFlowParameters parameters, Path jsonFile); static LoadFlowParameters update(LoadFlowParameters parameters, InputStream jsonStream); static void write(LoadFlowParameters parameters, Path jsonFile); static void write(LoadFlowParameters parameters, OutputStream outputStream); static LoadFlowParameters deserialize(JsonParser parser, DeserializationContext context, LoadFlowParameters parameters); static LoadFlowParameters deserialize(JsonParser parser, DeserializationContext context); static void serialize(LoadFlowParameters parameters, JsonGenerator jsonGenerator, SerializerProvider serializerProvider);  }
@Test public void readExtension() { LoadFlowParameters parameters = JsonLoadFlowParameters.read(getClass().getResourceAsStream("/LoadFlowParametersWithExtension.json")); assertEquals(1, parameters.getExtensions().size()); assertNotNull(parameters.getExtension(DummyExtension.class)); assertNotNull(parameters.getExtensionByName("dummy-extension")); }
@Test public void readError() { expected.expect(AssertionError.class); expected.expectMessage("Unexpected field: unknownParameter"); JsonLoadFlowParameters.read(getClass().getResourceAsStream("/LoadFlowParametersError.json")); }
@Test public void readJsonVersion10() { LoadFlowParameters parameters = JsonLoadFlowParameters .read(getClass().getResourceAsStream("/LoadFlowParametersVersion10.json")); assertTrue(parameters.isTwtSplitShuntAdmittance()); }
@Test public void readJsonVersion11() { LoadFlowParameters parameters = JsonLoadFlowParameters .read(getClass().getResourceAsStream("/LoadFlowParametersVersion11.json")); assertTrue(parameters.isTwtSplitShuntAdmittance()); }
@Test public void readJsonVersion12() { LoadFlowParameters parameters = JsonLoadFlowParameters .read(getClass().getResourceAsStream("/LoadFlowParametersVersion12.json")); assertTrue(parameters.isTwtSplitShuntAdmittance()); }
@Test public void readJsonVersion13() { LoadFlowParameters parameters = JsonLoadFlowParameters .read(getClass().getResourceAsStream("/LoadFlowParametersVersion13.json")); assertTrue(parameters.isSimulShunt()); assertTrue(parameters.isReadSlackBus()); assertTrue(parameters.isWriteSlackBus()); }
@Test public void readJsonVersion14() { LoadFlowParameters parameters = JsonLoadFlowParameters .read(getClass().getResourceAsStream("/LoadFlowParametersVersion14.json")); assertTrue(parameters.isDc()); assertTrue(parameters.isDistributedSlack()); assertEquals(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_LOAD, parameters.getBalanceType()); }
@Test public void readJsonVersion10Exception() { exception.expect(PowsyblException.class); exception.expectMessage("LoadFlowParameters. Tag: t2wtSplitShuntAdmittance is not valid for version 1.0. Version should be > 1.0"); JsonLoadFlowParameters.read(getClass().getResourceAsStream("/LoadFlowParametersVersion10Exception.json")); }
@Test public void readJsonVersion11Exception() { exception.expect(PowsyblException.class); exception.expectMessage("LoadFlowParameters. Tag: specificCompatibility is not valid for version 1.1. Version should be <= 1.0"); JsonLoadFlowParameters.read(getClass().getResourceAsStream("/LoadFlowParametersVersion11Exception.json")); }
@Test public void readJsonVersion12Exception() { exception.expect(PowsyblException.class); exception.expectMessage("LoadFlowParameters. Tag: t2wtSplitShuntAdmittance is not valid for version 1.2. Version should be <= 1.1"); JsonLoadFlowParameters.read(getClass().getResourceAsStream("/LoadFlowParametersVersion12Exception.json")); }