diff --git a/flow-decomposition/src/main/java/com/powsybl/flow_decomposition/LossesCompensator.java b/flow-decomposition/src/main/java/com/powsybl/flow_decomposition/LossesCompensator.java index 582d343e..874541f8 100644 --- a/flow-decomposition/src/main/java/com/powsybl/flow_decomposition/LossesCompensator.java +++ b/flow-decomposition/src/main/java/com/powsybl/flow_decomposition/LossesCompensator.java @@ -23,6 +23,7 @@ class LossesCompensator { private final double epsilon; private Integer networkHash; + public static final String LOSSES_ID_PREFIX = "LOSSES "; LossesCompensator(double epsilon) { this.epsilon = epsilon; @@ -34,7 +35,7 @@ class LossesCompensator { } static String getLossesId(String id) { - return String.format("LOSSES %s", id); + return LOSSES_ID_PREFIX + id; } public void run(Network network) { diff --git a/flow-decomposition/src/test/java/com/powsybl/flow_decomposition/FlowDecompositionObserverTest.java b/flow-decomposition/src/test/java/com/powsybl/flow_decomposition/FlowDecompositionObserverTest.java index 50559287..2239f08e 100644 --- a/flow-decomposition/src/test/java/com/powsybl/flow_decomposition/FlowDecompositionObserverTest.java +++ b/flow-decomposition/src/test/java/com/powsybl/flow_decomposition/FlowDecompositionObserverTest.java @@ -344,8 +344,7 @@ void testObserverWithEnableLossesCompensation() { flowComputer.run(xnecProvider, network); // there are no losses in acNodalInjection - String lossesId = LossesCompensator.getLossesId(""); - report.acNodalInjections.forBaseCase().forEach((inj, p) -> assertFalse(inj.startsWith(lossesId))); + report.acNodalInjections.forBaseCase().forEach((inj, p) -> assertFalse(inj.startsWith(LossesCompensator.LOSSES_ID_PREFIX))); } private void assertEventsFired(Collection firedEvents, Event... expectedEvents) {