diff --git a/diagram-util/pom.xml b/diagram-util/pom.xml index 6257ff754..64f67f248 100644 --- a/diagram-util/pom.xml +++ b/diagram-util/pom.xml @@ -51,8 +51,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter test diff --git a/diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/BoundingBoxTest.java b/diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/BoundingBoxTest.java index 397cd2f41..686d44dab 100644 --- a/diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/BoundingBoxTest.java +++ b/diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/BoundingBoxTest.java @@ -6,20 +6,19 @@ */ package com.powsybl.diagram.util.forcelayout; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.List; -import static org.junit.Assert.assertEquals; - /** * @author Thomas Adam */ -public class BoundingBoxTest { +class BoundingBoxTest { @Test - public void test() { + void test() { List points = new ArrayList<>(); points.add(new Point(1.0, 2.0)); points.add(new Point(3.0, 4.0)); diff --git a/diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/CanvasTest.java b/diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/CanvasTest.java index 9e652c75e..b319e5ea0 100644 --- a/diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/CanvasTest.java +++ b/diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/CanvasTest.java @@ -6,20 +6,19 @@ */ package com.powsybl.diagram.util.forcelayout; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.List; -import static org.junit.Assert.assertEquals; - /** * @author Thomas Adam */ -public class CanvasTest { +class CanvasTest { @Test - public void test() { + void test() { List points = new ArrayList<>(); points.add(new Point(1.0, 2.0)); points.add(new Point(3.0, 4.0)); diff --git a/diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/VectorTest.java b/diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/VectorTest.java index 720f706e9..200981917 100644 --- a/diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/VectorTest.java +++ b/diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/VectorTest.java @@ -6,17 +6,16 @@ */ package com.powsybl.diagram.util.forcelayout; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Thomas Adam */ -public class VectorTest { +class VectorTest { @Test - public void test() { + void test() { Vector vector = new Vector(1.0, 2.0); assertEquals(2.24, vector.magnitude(), 0.01); assertEquals(5.0, vector.magnitudeSquare(), 0.0); diff --git a/network-area-diagram/pom.xml b/network-area-diagram/pom.xml index 6401ef794..65368a60a 100644 --- a/network-area-diagram/pom.xml +++ b/network-area-diagram/pom.xml @@ -53,8 +53,8 @@ test - junit - junit + org.junit.jupiter + junit-jupiter test @@ -82,16 +82,6 @@ powsybl-config-test test - - com.powsybl - powsybl-loadflow-api - test - - - com.powsybl - powsybl-open-loadflow - test - diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/NetworkAreaDiagramTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/NetworkAreaDiagramTest.java index de56a7c7d..e3662218e 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/NetworkAreaDiagramTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/NetworkAreaDiagramTest.java @@ -22,8 +22,10 @@ import com.powsybl.nad.svg.SvgParameters; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider; -import org.junit.Before; -import org.junit.Test; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; import java.io.IOException; import java.nio.file.Files; @@ -31,17 +33,15 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import static org.junit.Assert.assertEquals; - /** * @author Thomas Adam */ -public class NetworkAreaDiagramTest extends AbstractTest { +class NetworkAreaDiagramTest extends AbstractTest { protected java.nio.file.FileSystem fileSystem; - @Before - public void setup() { + @BeforeEach + void setup() { fileSystem = Jimfs.newFileSystem(Configuration.unix()); setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() @@ -77,7 +77,7 @@ private String getContentFile(Path svgFile) { } @Test - public void testDrawSvg() { + void testDrawSvg() { Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses(); NetworkAreaDiagram nad = new NetworkAreaDiagram(network, VoltageLevelFilter.NO_FILTER); diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/layout/FixedLayoutTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/layout/FixedLayoutTest.java index d5cac43fe..93520aebf 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/layout/FixedLayoutTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/layout/FixedLayoutTest.java @@ -12,20 +12,20 @@ import com.powsybl.nad.model.Graph; import com.powsybl.nad.model.Point; import com.powsybl.nad.svg.NetworkTestFactory; -import org.junit.Test; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; /** * @author Luma Zamarreno */ -public class FixedLayoutTest { +class FixedLayoutTest { @Test - public void testCurrentLimits() { + void testCurrentLimits() { Network network = NetworkTestFactory.createTwoVoltageLevels(); Map expected = Map.of( diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/layout/ForceLayoutTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/layout/ForceLayoutTest.java index 9cf94e82e..2f0caf33a 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/layout/ForceLayoutTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/layout/ForceLayoutTest.java @@ -13,18 +13,18 @@ import com.powsybl.nad.svg.SvgParameters; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider; -import org.junit.Before; -import org.junit.Test; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; /** * @author Luma Zamarreno */ -public class ForceLayoutTest extends AbstractTest { +class ForceLayoutTest extends AbstractTest { - @Before - public void setup() { + @BeforeEach + void setup() { setLayoutParameters(new LayoutParameters().setTextNodesForceLayout(false)); setSvgParameters(new SvgParameters() .setInsertNameDesc(false) @@ -42,14 +42,14 @@ protected LabelProvider getLabelProvider(Network network) { } @Test - public void testDiamondNoSpringRepulsionFactor() { + void testDiamondNoSpringRepulsionFactor() { assertEquals( toString("/diamond-spring-repulsion-factor-0.0.svg"), generateSvgString(LayoutNetworkFactory.createDiamond(), "/diamond-spring-repulsion-factor-0.0.svg")); } @Test - public void testDiamondSmallSpringRepulsionFactor() { + void testDiamondSmallSpringRepulsionFactor() { getLayoutParameters().setSpringRepulsionFactorForceLayout(0.2); assertEquals( toString("/diamond-spring-repulsion-factor-0.2.svg"), diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/layout/LayoutNetworkFactory.java b/network-area-diagram/src/test/java/com/powsybl/nad/layout/LayoutNetworkFactory.java index 8889e21c6..df93bd31f 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/layout/LayoutNetworkFactory.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/layout/LayoutNetworkFactory.java @@ -11,7 +11,7 @@ /** * @author Luma Zamarreno */ -public final class LayoutNetworkFactory { +final class LayoutNetworkFactory { private LayoutNetworkFactory() { // Empty diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/layout/LayoutParametersTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/layout/LayoutParametersTest.java index 24d33c785..a95b0b152 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/layout/LayoutParametersTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/layout/LayoutParametersTest.java @@ -6,17 +6,16 @@ */ package com.powsybl.nad.layout; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Florian Dupuy */ -public class LayoutParametersTest { +class LayoutParametersTest { @Test - public void test() { + void test() { LayoutParameters layoutParameters0 = new LayoutParameters() .setTextNodesForceLayout(true) .setSpringRepulsionFactorForceLayout(1.0) diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/layout/LayoutWithInitialPositionsTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/layout/LayoutWithInitialPositionsTest.java index d76d89530..c5cb679b6 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/layout/LayoutWithInitialPositionsTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/layout/LayoutWithInitialPositionsTest.java @@ -19,8 +19,12 @@ import com.powsybl.nad.svg.SvgParameters; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.StringWriter; import java.util.Collections; @@ -28,15 +32,13 @@ import java.util.Set; import java.util.function.Predicate; -import static org.junit.Assert.*; - /** * @author Luma Zamarreno */ -public class LayoutWithInitialPositionsTest extends AbstractTest { +class LayoutWithInitialPositionsTest extends AbstractTest { - @Before - public void setup() { + @BeforeEach + void setup() { setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() .setInsertNameDesc(true) @@ -55,12 +57,12 @@ protected LabelProvider getLabelProvider(Network network) { } @Test - public void testDiamond() { + void testDiamond() { checkLayoutWithInitialPositions(LayoutNetworkFactory.createDiamond()); } @Test - public void testNbVoltageLevels() { + void testNbVoltageLevels() { Network network = LayoutNetworkFactory.createDiamond(); assertEquals(1, VoltageLevelFilter.createVoltageLevelDepthFilter(network, "A 400", 0).getNbVoltageLevels()); diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/DanglingLineTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/DanglingLineTest.java index f511899b8..ce2084900 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/DanglingLineTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/DanglingLineTest.java @@ -12,18 +12,17 @@ import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Luma ZamarreƱo */ -public class DanglingLineTest extends AbstractTest { +class DanglingLineTest extends AbstractTest { - @Before - public void setup() { + @BeforeEach + void setup() { setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() .setSvgWidthAndHeightAdded(true) @@ -42,13 +41,13 @@ protected LabelProvider getLabelProvider(Network network) { } @Test - public void testConnected() { + void testConnected() { Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses(); assertEquals(toString("/dangling_line_connected.svg"), generateSvgString(network, "/dangling_line_connected.svg")); } @Test - public void testDisconnected() { + void testDisconnected() { Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses(); network.getDanglingLines().iterator().next().getTerminal().disconnect(); assertEquals(toString("/dangling_line_disconnected.svg"), generateSvgString(network, "/dangling_line_disconnected.svg")); diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/DiagramMetadataTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/DiagramMetadataTest.java index ac29282bd..7e6b23213 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/DiagramMetadataTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/DiagramMetadataTest.java @@ -16,9 +16,10 @@ import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.TopologicalStyleProvider; import com.powsybl.nad.svg.metadata.DiagramMetadata; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; @@ -29,12 +30,10 @@ import java.nio.file.Path; import java.util.Objects; -import static org.junit.Assert.assertEquals; - /** * @author Thomas Adam */ -public class DiagramMetadataTest extends AbstractTest { +class DiagramMetadataTest extends AbstractTest { private static final String INDENT = " "; private static final String METADATA = "metadata"; @@ -44,8 +43,8 @@ public class DiagramMetadataTest extends AbstractTest { private FileSystem fileSystem; private Path tmpDir; - @Before - public void setup() throws IOException { + @BeforeEach + void setup() throws IOException { fileSystem = Jimfs.newFileSystem(Configuration.unix()); tmpDir = Files.createDirectory(fileSystem.getPath("tmp")); setLayoutParameters(new LayoutParameters()); @@ -55,8 +54,8 @@ public void setup() throws IOException { .setFixedWidth(800)); } - @After - public void tearDown() throws IOException { + @AfterEach + void tearDown() throws IOException { fileSystem.close(); } @@ -71,7 +70,7 @@ protected LabelProvider getLabelProvider(Network network) { } @Test - public void test() throws XMLStreamException { + void test() throws XMLStreamException { // Referenced svg file String reference = "/hvdc.svg"; InputStream in = Objects.requireNonNull(getClass().getResourceAsStream(reference)); @@ -92,7 +91,7 @@ public void test() throws XMLStreamException { } @Test - public void testInvalid() throws XMLStreamException { + void testInvalid() throws XMLStreamException { // Referenced svg file String reference = "\n" + " \n" + diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeIdTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeIdTest.java index cca1eace1..b39ac1e10 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeIdTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeIdTest.java @@ -11,18 +11,17 @@ import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Florian Dupuy */ -public class EdgeIdTest extends AbstractTest { +class EdgeIdTest extends AbstractTest { - @Before - public void setup() { + @BeforeEach + void setup() { setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() .setSvgWidthAndHeightAdded(true) @@ -41,14 +40,14 @@ protected LabelProvider getLabelProvider(Network network) { } @Test - public void testNameOnEdgeDisplayed() { + void testNameOnEdgeDisplayed() { Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses(); getSvgParameters().setEdgeNameDisplayed(true); assertEquals(toString("/edge_with_id.svg"), generateSvgString(network, "/edge_with_id.svg")); } @Test - public void testNameOnEdgeNotDisplayed() { + void testNameOnEdgeNotDisplayed() { Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses(); getSvgParameters().setEdgeNameDisplayed(false); assertEquals(toString("/edge_without_id.svg"), generateSvgString(network, "/edge_without_id.svg")); diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoLabelTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoLabelTest.java index 16304b176..eabf864fb 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoLabelTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoLabelTest.java @@ -15,23 +15,22 @@ import com.powsybl.nad.model.ThreeWtEdge; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; import java.util.Collections; import java.util.List; -import static org.junit.Assert.assertEquals; - /** * @author Florian Dupuy */ -public class EdgeInfoLabelTest extends AbstractTest { +class EdgeInfoLabelTest extends AbstractTest { private String internalLabel; private String externalLabel; - @Before + @BeforeEach public void setup() { setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() @@ -70,14 +69,14 @@ public String getArrowPathDOut() { // thinner arrow } @Test - public void testMissingLabels() { + void testMissingLabels() { Network network = NetworkTestFactory.createTwoVoltageLevels(); getSvgParameters().setArrowShift(10); assertEquals(toString("/edge_info_missing_label.svg"), generateSvgString(network, "/edge_info_missing_label.svg")); } @Test - public void testPerpendicularLabels() { + void testPerpendicularLabels() { Network network = NetworkTestFactory.createTwoVoltageLevels(); internalLabel = "int"; externalLabel = "ext"; @@ -88,7 +87,7 @@ public void testPerpendicularLabels() { } @Test - public void testParallelLabels() { + void testParallelLabels() { Network network = ThreeWindingsTransformerNetworkFactory.create(); internalLabel = "243"; externalLabel = "145"; diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoShiftTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoShiftTest.java index 162a22fea..97860d70b 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoShiftTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoShiftTest.java @@ -11,18 +11,18 @@ import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider; -import org.junit.Before; -import org.junit.Test; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Florian Dupuy */ -public class EdgeInfoShiftTest extends AbstractTest { +class EdgeInfoShiftTest extends AbstractTest { - @Before - public void setup() { + @BeforeEach + void setup() { setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() .setSvgWidthAndHeightAdded(true) @@ -40,7 +40,7 @@ protected LabelProvider getLabelProvider(Network network) { } @Test - public void testArrowShift() { + void testArrowShift() { Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses(); getSvgParameters().setArrowShift(20); assertEquals(toString("/edge_info_shift.svg"), generateSvgString(network, "/edge_info_shift.svg")); diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/HvdcTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/HvdcTest.java index 482ba4df7..43f790718 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/HvdcTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/HvdcTest.java @@ -13,18 +13,17 @@ import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Luma ZamarreƱo */ -public class HvdcTest extends AbstractTest { +class HvdcTest extends AbstractTest { - @Before - public void setup() { + @BeforeEach + void setup() { setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() .setInsertNameDesc(true) @@ -43,7 +42,7 @@ protected LabelProvider getLabelProvider(Network network) { } @Test - public void testHvdcVL1Depth1() { + void testHvdcVL1Depth1() { Network network = HvdcTestNetwork.createVsc(); assertEquals( toString("/hvdc-vl-depth-1.svg"), diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/LimitsTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/LimitsTest.java index ad55aec38..a761b3559 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/LimitsTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/LimitsTest.java @@ -11,18 +11,17 @@ import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Florian Dupuy */ -public class LimitsTest extends AbstractTest { +class LimitsTest extends AbstractTest { - @Before - public void setup() { + @BeforeEach + void setup() { setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() .setSvgWidthAndHeightAdded(true) @@ -40,7 +39,7 @@ protected LabelProvider getLabelProvider(Network network) { } @Test - public void testVoltageLimits() { + void testVoltageLimits() { Network network = NetworkTestFactory.createTwoVoltageLevelsThreeBuses(); network.getVoltageLevel("vl1") .setHighVoltageLimit(385) @@ -52,7 +51,7 @@ public void testVoltageLimits() { } @Test - public void testCurrentLimits() { + void testCurrentLimits() { Network network = NetworkTestFactory.createTwoVoltageLevels(); network.getLine("l1").newCurrentLimits1().setPermanentLimit(250).add(); network.getLine("l1").getTerminal1().setP(101).setQ(150).getBusView().getBus().setV(390); diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/NominalVoltageStyleTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/NominalVoltageStyleTest.java index dab0f094e..aeae6a1bb 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/NominalVoltageStyleTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/NominalVoltageStyleTest.java @@ -12,23 +12,21 @@ import com.powsybl.iidm.network.Terminal; import com.powsybl.iidm.network.test.FourSubstationsNodeBreakerFactory; import com.powsybl.iidm.xml.NetworkXml; -import com.powsybl.loadflow.LoadFlow; import com.powsybl.nad.AbstractTest; import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Florian Dupuy */ -public class NominalVoltageStyleTest extends AbstractTest { +class NominalVoltageStyleTest extends AbstractTest { - @Before - public void setup() { + @BeforeEach + void setup() { setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() .setInsertNameDesc(true) @@ -49,44 +47,42 @@ protected LabelProvider getLabelProvider(Network network) { } @Test - public void testIEEE30() { + void testIEEE30() { Network network = IeeeCdfNetworkFactory.create30(); assertEquals(toString("/IEEE_30_bus.svg"), generateSvgString(network, "/IEEE_30_bus.svg")); } @Test - public void testIEEE14() { - Network network = IeeeCdfNetworkFactory.create14(); - LoadFlow.run(network); + void testIEEE14() { + Network network = IeeeCdfNetworkFactory.create14Solved(); assertEquals(toString("/IEEE_14_bus.svg"), generateSvgString(network, "/IEEE_14_bus.svg")); } @Test - public void testIEEE14ForceLayoutWithTextNodes() { + void testIEEE14ForceLayoutWithTextNodes() { Network network = IeeeCdfNetworkFactory.create14(); getLayoutParameters().setTextNodesForceLayout(true); assertEquals(toString("/IEEE_14_bus_text_nodes.svg"), generateSvgString(network, "/IEEE_14_bus_text_nodes.svg")); } @Test - public void testIEEE14FWithSvgPrefix() { + void testIEEE14FWithSvgPrefix() { Network network = IeeeCdfNetworkFactory.create14(); getSvgParameters().setSvgPrefix("test_"); assertEquals(toString("/IEEE_14_id_prefixed.svg"), generateSvgString(network, "/IEEE_14_id_prefixed.svg")); } @Test - public void testDisconnection() { - Network network = IeeeCdfNetworkFactory.create14(); + void testDisconnection() { + Network network = IeeeCdfNetworkFactory.create14Solved(); network.getLine("L3-4-1").getTerminal1().disconnect(); network.getTwoWindingsTransformer("T4-7-1").getTerminal1().disconnect(); network.getVoltageLevel("VL14").getConnectableStream().map(connectable -> (Connectable) connectable).forEach(connectable -> connectable.getTerminals().forEach(Terminal::disconnect)); - LoadFlow.run(network); assertEquals(toString("/IEEE_14_bus_disconnection.svg"), generateSvgString(network, "/IEEE_14_bus_disconnection.svg")); } @Test - public void testFictitiousVoltageLevel() { + void testFictitiousVoltageLevel() { Network network = IeeeCdfNetworkFactory.create14(); network.getVoltageLevel("VL12").setFictitious(true); network.getVoltageLevel("VL14").setFictitious(true); @@ -94,13 +90,13 @@ public void testFictitiousVoltageLevel() { } @Test - public void testIEEE24() { + void testIEEE24() { Network network = NetworkXml.read(getClass().getResourceAsStream("/IEEE_24_bus.xiidm")); assertEquals(toString("/IEEE_24_bus.svg"), generateSvgString(network, "/IEEE_24_bus.svg")); } @Test - public void testHvdc() { + void testHvdc() { Network network = FourSubstationsNodeBreakerFactory.create(); assertEquals(toString("/hvdc.svg"), generateSvgString(network, "/hvdc.svg")); } diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/ParallelTransformerTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/ParallelTransformerTest.java index c35193b20..82b227d1a 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/ParallelTransformerTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/ParallelTransformerTest.java @@ -11,17 +11,16 @@ import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Florian Dupuy */ -public class ParallelTransformerTest extends AbstractTest { +class ParallelTransformerTest extends AbstractTest { - @Before + @BeforeEach public void setup() { setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() @@ -40,7 +39,7 @@ protected LabelProvider getLabelProvider(Network network) { } @Test - public void test() { + void test() { Network network = NetworkTestFactory.createTwoVoltageLevelsTwoTransformers(); assertEquals(toString("/parallel_transformers.svg"), generateSvgString(network, "/parallel_transformers.svg")); } diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/SvgParametersTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/SvgParametersTest.java index 9303e4c2c..02fc4ac22 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/SvgParametersTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/SvgParametersTest.java @@ -6,17 +6,16 @@ */ package com.powsybl.nad.svg; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Florian Dupuy */ -public class SvgParametersTest { +class SvgParametersTest { @Test - public void test() { + void test() { SvgParameters svgParameters0 = new SvgParameters() .setDiagramPadding(new Padding(5)) .setInsertNameDesc(false) diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/TextNodeTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/TextNodeTest.java index a21a0c66a..f85c0053c 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/TextNodeTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/TextNodeTest.java @@ -13,22 +13,21 @@ import com.powsybl.nad.model.VoltageLevelNode; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.TopologicalStyleProvider; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.List; -import static org.junit.Assert.assertEquals; - /** * @author Florian Dupuy */ -public class TextNodeTest extends AbstractTest { +class TextNodeTest extends AbstractTest { private LabelProvider labelProvider; - @Before - public void setup() { + @BeforeEach + void setup() { setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() .setSvgWidthAndHeightAdded(true) @@ -59,7 +58,7 @@ public List getVoltageLevelDetails(VoltageLevelNode vlNode) { } @Test - public void testVlId() { + void testVlId() { Network network = NetworkTestFactory.createTwoVoltageLevels(); getSvgParameters().setIdDisplayed(true).setBusLegend(false); labelProvider = new DefaultLabelProvider(network, getSvgParameters()); @@ -67,7 +66,7 @@ public void testVlId() { } @Test - public void testSubstationDescription() { + void testSubstationDescription() { Network network = NetworkTestFactory.createTwoVoltageLevels(); getSvgParameters().setSubstationDescriptionDisplayed(true).setBusLegend(false).setVoltageLevelDetails(true); labelProvider = new DefaultLabelProvider(network, getSvgParameters()); @@ -75,21 +74,21 @@ public void testSubstationDescription() { } @Test - public void testSubstationId() { + void testSubstationId() { Network network = NetworkTestFactory.createTwoVoltageLevels(); getSvgParameters().setSubstationDescriptionDisplayed(true).setIdDisplayed(true).setBusLegend(false); assertEquals(toString("/vl_description_substation_id.svg"), generateSvgString(network, "/vl_description_substation_id.svg")); } @Test - public void testDetailedTextNodeNoBusLegend() { + void testDetailedTextNodeNoBusLegend() { Network network = NetworkTestFactory.createTwoVoltageLevels(); getSvgParameters().setVoltageLevelDetails(true).setBusLegend(false); assertEquals(toString("/detailed_text_node_no_legend.svg"), generateSvgString(network, "/detailed_text_node_no_legend.svg")); } @Test - public void testDetailedTextNode() { + void testDetailedTextNode() { Network network = NetworkTestFactory.createTwoVoltageLevels(); getSvgParameters().setVoltageLevelDetails(true).setSubstationDescriptionDisplayed(true); assertEquals(toString("/detailed_text_node.svg"), generateSvgString(network, "/detailed_text_node.svg")); diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/ThreeWindingTransformerTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/ThreeWindingTransformerTest.java index 68d2ca146..b955abf2d 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/ThreeWindingTransformerTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/ThreeWindingTransformerTest.java @@ -15,22 +15,21 @@ import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider; import com.powsybl.nad.svg.iidm.TopologicalStyleProvider; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Collections; -import static org.junit.Assert.assertEquals; - /** * @author Florian Dupuy */ -public class ThreeWindingTransformerTest extends AbstractTest { +class ThreeWindingTransformerTest extends AbstractTest { private StyleProvider styleProvider; - @Before - public void setup() { + @BeforeEach + void setup() { setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() .setInsertNameDesc(true) @@ -49,13 +48,13 @@ protected LabelProvider getLabelProvider(Network network) { } @Test - public void test3wt() { + void test3wt() { Network network = ThreeWindingsTransformerNetworkFactory.create(); assertEquals(toString("/3wt.svg"), generateSvgString(network, "/3wt.svg")); } @Test - public void testDisconnected3wt() { + void testDisconnected3wt() { Network network = ThreeWindingsTransformerNetworkFactory.create(); network.getThreeWindingsTransformer("3WT").getTerminal(ThreeWindingsTransformer.Side.TWO).disconnect(); network.getLoad("LOAD_33").remove(); @@ -63,7 +62,7 @@ public void testDisconnected3wt() { } @Test - public void testDisconnected3wtTopologicalStyle() { + void testDisconnected3wtTopologicalStyle() { Network network = ThreeWindingsTransformerNetworkFactory.create(); network.getThreeWindingsTransformer("3WT").getTerminal(ThreeWindingsTransformer.Side.TWO).disconnect(); network.getLoad("LOAD_33").remove(); @@ -72,7 +71,7 @@ public void testDisconnected3wtTopologicalStyle() { } @Test - public void testPartial3wt() { + void testPartial3wt() { Network network = ThreeWindingsTransformerNetworkFactory.create(); VoltageLevelFilter filter = VoltageLevelFilter.createVoltageLevelsFilter(network, Collections.singletonList("VL_11")); assertEquals(toString("/3wt_partial.svg"), generateSvgString(network, filter, "/3wt_partial.svg")); diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/TopologicalStyleTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/TopologicalStyleTest.java index ad45e273f..e5509adbf 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/TopologicalStyleTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/TopologicalStyleTest.java @@ -8,26 +8,24 @@ import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; import com.powsybl.iidm.network.Network; -import com.powsybl.loadflow.LoadFlow; import com.powsybl.nad.AbstractTest; import com.powsybl.nad.build.iidm.VoltageLevelFilter; import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.TopologicalStyleProvider; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Arrays; -import static org.junit.Assert.assertEquals; - /** * @author Florian Dupuy */ -public class TopologicalStyleTest extends AbstractTest { +class TopologicalStyleTest extends AbstractTest { - @Before - public void setup() { + @BeforeEach + void setup() { setLayoutParameters(new LayoutParameters()); setSvgParameters(new SvgParameters() .setInsertNameDesc(true) @@ -46,47 +44,46 @@ protected LabelProvider getLabelProvider(Network network) { } @Test - public void testIEEE57() { + void testIEEE57() { Network network = IeeeCdfNetworkFactory.create57(); assertEquals(toString("/IEEE_57_bus.svg"), generateSvgString(network, "/IEEE_57_bus.svg")); } @Test - public void testIEEE118() { + void testIEEE118() { Network network = IeeeCdfNetworkFactory.create118(); assertEquals(toString("/IEEE_118_bus.svg"), generateSvgString(network, "/IEEE_118_bus.svg")); } @Test - public void testIEEE118PartialGraph() { + void testIEEE118PartialGraph() { Network network = IeeeCdfNetworkFactory.create118(); VoltageLevelFilter vlDepthFilter = VoltageLevelFilter.createVoltageLevelDepthFilter(network, "VL54", 2); assertEquals(toString("/IEEE_118_bus_partial.svg"), generateSvgString(network, vlDepthFilter, "/IEEE_118_bus_partial.svg")); } @Test - public void testIEEE118PartialNonConnectedGraph() { + void testIEEE118PartialNonConnectedGraph() { Network network = IeeeCdfNetworkFactory.create118(); VoltageLevelFilter vlDepthFilter = VoltageLevelFilter.createVoltageLevelsDepthFilter(network, Arrays.asList("VL32", "VL38"), 1); assertEquals(toString("/IEEE_118_bus_partial_non_connected.svg"), generateSvgString(network, vlDepthFilter, "/IEEE_118_bus_partial_non_connected.svg")); } @Test - public void testEurope() { + void testEurope() { Network network = Network.read("simple-eu.uct", getClass().getResourceAsStream("/simple-eu.uct")); - LoadFlow.run(network); assertEquals(toString("/simple-eu.svg"), generateSvgString(network, "/simple-eu.svg")); } @Test - public void testEuropeLoopAperture80() { + void testEuropeLoopAperture80() { Network network = Network.read("simple-eu.uct", getClass().getResourceAsStream("/simple-eu.uct")); getSvgParameters().setLoopEdgesAperture(80); assertEquals(toString("/simple-eu-loop80.svg"), generateSvgString(network, "/simple-eu-loop80.svg")); } @Test - public void testEuropeLoopAperture100() { + void testEuropeLoopAperture100() { Network network = Network.read("simple-eu.uct", getClass().getResourceAsStream("/simple-eu.uct")); getSvgParameters().setLoopEdgesAperture(100); assertEquals(toString("/simple-eu-loop100.svg"), generateSvgString(network, "/simple-eu-loop100.svg")); diff --git a/network-area-diagram/src/test/resources/IEEE_14_bus.svg b/network-area-diagram/src/test/resources/IEEE_14_bus.svg index a14a4c3f8..f8b10b278 100644 --- a/network-area-diagram/src/test/resources/IEEE_14_bus.svg +++ b/network-area-diagram/src/test/resources/IEEE_14_bus.svg @@ -1,5 +1,5 @@ - +