-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: p-arvy <[email protected]>
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
...c/test/java/com/powsybl/openreac/parameters/output/ShuntCompensatorNetworkOutputTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
package com.powsybl.openreac.parameters.output; | ||
|
||
import com.powsybl.ampl.converter.AmplSubset; | ||
import com.powsybl.commons.util.StringToIntMapper; | ||
import com.powsybl.iidm.network.Network; | ||
import com.powsybl.openreac.parameters.output.network.ShuntCompensatorNetworkOutput; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
|
||
import static com.powsybl.openreac.network.ShuntNetworkFactory.create; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
/** | ||
* @author Pierre Arvy {@literal <pierre.arvy at artelys.com>} | ||
*/ | ||
public class ShuntCompensatorNetworkOutputTest { | ||
|
||
@Test | ||
void readTestNullShunt() throws IOException { | ||
Network network = create(); | ||
ShuntCompensatorNetworkOutput output = new ShuntCompensatorNetworkOutput(network, 0); | ||
StringToIntMapper<AmplSubset> mapper = new StringToIntMapper<>(AmplSubset.class); | ||
mapper.newInt(AmplSubset.SHUNT, "shuntId"); | ||
try (InputStream input = getClass().getResourceAsStream("/mock_outputs/reactiveopf_results_shunts.csv"); | ||
InputStreamReader in = new InputStreamReader(input); | ||
BufferedReader reader = new BufferedReader(in)) { | ||
output.read(reader, mapper); | ||
assertEquals(1, output.getModifications().size()); | ||
assertEquals("shuntId", output.getModifications().get(0).getShuntCompensatorId()); | ||
assertNull(output.getModifications().get(0).getConnect()); | ||
assertNull(output.getModifications().get(0).getSectionCount()); | ||
} | ||
} | ||
|
||
} |