diff --git a/src/test/java/org/gridsuite/modification/server/utils/ModificationCreation.java b/src/test/java/org/gridsuite/modification/server/utils/ModificationCreation.java index a4921ffb9..274a7edd7 100644 --- a/src/test/java/org/gridsuite/modification/server/utils/ModificationCreation.java +++ b/src/test/java/org/gridsuite/modification/server/utils/ModificationCreation.java @@ -10,18 +10,21 @@ import com.powsybl.iidm.network.EnergySource; import com.powsybl.iidm.network.SwitchKind; import com.powsybl.iidm.network.extensions.ConnectablePosition; -import org.gridsuite.modification.server.dto.*; +import lombok.experimental.UtilityClass; +import org.gridsuite.modification.server.dto.CouplingDeviceInfos; +import org.gridsuite.modification.server.dto.GeneratorCreationInfos; +import org.gridsuite.modification.server.dto.ReactiveCapabilityCurveCreationInfos; +import org.gridsuite.modification.server.dto.VoltageLevelCreationInfos; + import java.util.Arrays; +import java.util.List; /** * @author Slimane Amar */ -public final class ModificationCreation { - - private ModificationCreation() { - } - - public static VoltageLevelCreationInfos getCreationVoltageLevel(String substationId, String voltageLevelId, String voltageLevelName) { +@UtilityClass +public class ModificationCreation { + public VoltageLevelCreationInfos getCreationVoltageLevel(String substationId, String voltageLevelId, String voltageLevelName) { return VoltageLevelCreationInfos.builder() .equipmentId(voltageLevelId) .equipmentName(voltageLevelName) @@ -37,8 +40,8 @@ public static VoltageLevelCreationInfos getCreationVoltageLevel(String substatio .couplingDevices(Arrays.asList(CouplingDeviceInfos.builder().busbarSectionId1("1A").busbarSectionId2("1B").build())).build(); } - public static GeneratorCreationInfos getCreationGenerator(String vlId, String generatorId, String generatorName, String busOrBusbarSectionId, - String regulatingTerminalId, String regulatingTerminalType, String regulatingTerminalVlId) { + public GeneratorCreationInfos getCreationGenerator(String vlId, String generatorId, String generatorName, String busOrBusbarSectionId, + String regulatingTerminalId, String regulatingTerminalType, String regulatingTerminalVlId) { return GeneratorCreationInfos.builder() .equipmentId(generatorId) .equipmentName(generatorName) diff --git a/src/test/java/org/gridsuite/modification/server/utils/NetworkCreation.java b/src/test/java/org/gridsuite/modification/server/utils/NetworkCreation.java index 769d9e89e..3adcbc0ba 100644 --- a/src/test/java/org/gridsuite/modification/server/utils/NetworkCreation.java +++ b/src/test/java/org/gridsuite/modification/server/utils/NetworkCreation.java @@ -10,22 +10,21 @@ import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.ConnectablePosition; import com.powsybl.network.store.iidm.impl.NetworkFactoryImpl; +import lombok.experimental.UtilityClass; import java.util.UUID; import static org.gridsuite.modification.server.utils.NetworkUtil.*; -public final class NetworkCreation { - public static final String VARIANT_ID = "variant_1"; +@UtilityClass +public class NetworkCreation { + public final String VARIANT_ID = "variant_1"; - private NetworkCreation() { - } - - public static Network create(UUID uuid, boolean createHvdcLine) { + public Network create(UUID uuid, boolean createHvdcLine) { return create(uuid, createHvdcLine, new NetworkFactoryImpl()); } - public static Network create(UUID uuid, boolean createHvdcLine, NetworkFactory networkFactory) { + public Network create(UUID uuid, boolean createHvdcLine, NetworkFactory networkFactory) { Network network = networkFactory.createNetwork(uuid.toString(), "test"); Substation s1 = createSubstation(network, "s1", "s1", Country.FR); @@ -235,7 +234,7 @@ public static Network create(UUID uuid, boolean createHvdcLine, NetworkFactory n return network; } - public static Network createBusBreaker(UUID uuid) { + public Network createBusBreaker(UUID uuid) { Network network = new NetworkFactoryImpl().createNetwork(uuid.toString(), "test"); Substation s1 = createSubstation(network, "s1", "s1", Country.FR); @@ -250,7 +249,7 @@ public static Network createBusBreaker(UUID uuid) { return network; } - public static Network createMixedTopology(UUID uuid) { + public Network createMixedTopology(UUID uuid) { Network network = new NetworkFactoryImpl().createNetwork(uuid.toString(), "test"); Substation s1 = createSubstation(network, "s1", "s1", Country.FR); @@ -270,6 +269,7 @@ public static Network createMixedTopology(UUID uuid) { } /** + *
      *     VL1            VL2            VL3
      *
      *     ld1            g2              ld3
@@ -280,8 +280,9 @@ public static Network createMixedTopology(UUID uuid) {
      *      |              |               |
      *     bbs1 ----------bbs2------------bbs3
      *            l1             l2
+     *  
*/ - public static Network createForDeleteVoltageLevelOnLine(UUID uuid) { + public Network createForDeleteVoltageLevelOnLine(UUID uuid) { Network network = new NetworkFactoryImpl().createNetwork(uuid.toString(), "NetworkForDeleteVoltageLevelOnLine"); // VL1 diff --git a/src/test/java/org/gridsuite/modification/server/utils/NetworkWithTeePoint.java b/src/test/java/org/gridsuite/modification/server/utils/NetworkWithTeePoint.java index a86008f1f..29c8319cb 100644 --- a/src/test/java/org/gridsuite/modification/server/utils/NetworkWithTeePoint.java +++ b/src/test/java/org/gridsuite/modification/server/utils/NetworkWithTeePoint.java @@ -7,9 +7,16 @@ package org.gridsuite.modification.server.utils; -import com.powsybl.iidm.network.*; +import com.powsybl.iidm.network.Country; +import com.powsybl.iidm.network.Network; +import com.powsybl.iidm.network.NetworkFactory; +import com.powsybl.iidm.network.Substation; +import com.powsybl.iidm.network.SwitchKind; +import com.powsybl.iidm.network.TopologyKind; +import com.powsybl.iidm.network.VoltageLevel; import com.powsybl.iidm.network.extensions.ConnectablePosition; import com.powsybl.network.store.iidm.impl.NetworkFactoryImpl; +import lombok.experimental.UtilityClass; import java.util.UUID; @@ -19,16 +26,14 @@ * * @author Geoffroy Jamgotchian */ -public final class NetworkWithTeePoint { - - private NetworkWithTeePoint() { - } - - public static Network create(UUID uuid) { +@UtilityClass +public class NetworkWithTeePoint { + public Network create(UUID uuid) { return create(uuid, new NetworkFactoryImpl()); } /** + *
      *     VL1            VL2            VL3
      *
      *     ld1            g2              ld3
@@ -48,9 +53,10 @@ public static Network create(UUID uuid) {
      *                    br4
      *                    |
      *                    ld4
+     * 
*/ - public static Network create(UUID uuid, NetworkFactory networkFactory) { + public Network create(UUID uuid, NetworkFactory networkFactory) { Network network = networkFactory.createNetwork(uuid.toString(), "NetworkWithTeePoint"); // VL1 diff --git a/src/test/java/org/gridsuite/modification/server/utils/WireMockUtils.java b/src/test/java/org/gridsuite/modification/server/utils/WireMockUtils.java index f57643473..859a48477 100644 --- a/src/test/java/org/gridsuite/modification/server/utils/WireMockUtils.java +++ b/src/test/java/org/gridsuite/modification/server/utils/WireMockUtils.java @@ -12,21 +12,18 @@ import com.github.tomakehurst.wiremock.matching.RequestPatternBuilder; import com.github.tomakehurst.wiremock.matching.StringValuePattern; import com.github.tomakehurst.wiremock.stubbing.ServeEvent; +import lombok.Data; import java.util.List; import java.util.Map; import java.util.UUID; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; +@Data public class WireMockUtils { - private final WireMockServer wireMockServer; - public WireMockUtils(WireMockServer wireMockServer) { - this.wireMockServer = wireMockServer; - } - public void verifyGetRequest(UUID stubId, String urlPath, Map queryParams, boolean regexMatching) { RequestPatternBuilder requestBuilder = regexMatching ? WireMock.getRequestedFor(WireMock.urlPathMatching(urlPath)) : WireMock.getRequestedFor(WireMock.urlPathEqualTo(urlPath)); queryParams.forEach(requestBuilder::withQueryParam); @@ -36,7 +33,7 @@ public void verifyGetRequest(UUID stubId, String urlPath, Map serveEvents = wireMockServer.getServeEvents(ServeEventQuery.forStubMapping(stubId)).getServeEvents(); - assertEquals(nbRequests, serveEvents.size()); + assertThat(serveEvents).hasSize(nbRequests); for (ServeEvent serveEvent : serveEvents) { wireMockServer.removeServeEvent(serveEvent.getId()); }