Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump junit to version 5 #182

Merged
merged 3 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/**
* @author Florian Dupuy <florian.dupuy at rte-france.com>
*/
public abstract class AbstractDynawoCommonsTest extends AbstractConverterTest {
abstract class AbstractDynawoCommonsTest extends AbstractConverterTest {

protected void compare(String expectedIidmResource, Network actual) throws IOException {
InputStream expected = Objects.requireNonNull(getClass().getResourceAsStream(expectedIidmResource));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@

import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.test.AbstractConverterTest;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public class DynawoVersionTest extends AbstractConverterTest {
class DynawoVersionTest extends AbstractConverterTest {

private static final DynawoVersion DV_MIN = new DynawoVersion(1, 3, 0);

@Test
public void testDynawoVersionCreation() {
void testDynawoVersionCreation() {
assertEquals("1.3.4", new DynawoVersion(1, 3, 4).toString());
assertEquals("1.10.4", DynawoVersion.createFromString("1.10.4").toString());
assertEquals("1.10.4", DynawoVersion.createFromString("1:10:4", ":").toString());
Expand All @@ -35,17 +35,17 @@ public void testDynawoVersionCreation() {
}

@Test
public void testEquals() {
void testEquals() {
DynawoVersion dv1 = DV_MIN;
DynawoVersion dv2 = DynawoVersion.createFromString("1.3");
assertEquals(DV_MIN, dv1);
assertEquals(DV_MIN, dv2);
assertNotEquals(DV_MIN, null);
assertNotEquals(DV_MIN, "1.3.0");
assertNotEquals(null, DV_MIN);
assertNotEquals("1.3.0", DV_MIN);
}

@Test
public void testVersionEqual() {
void testVersionEqual() {
DynawoVersion dv1 = DynawoVersion.createFromString("1.3.0");
DynawoVersion dv2 = DynawoVersion.createFromString("1.3");
DynawoVersion dv3 = DynawoVersion.createFromString("1.3.0.0");
Expand All @@ -55,7 +55,7 @@ public void testVersionEqual() {
}

@Test
public void testVersionAboveMin() {
void testVersionAboveMin() {
DynawoVersion dv1 = DynawoVersion.createFromString("1.3.1");
DynawoVersion dv2 = DynawoVersion.createFromString("2.1");
DynawoVersion dv3 = DynawoVersion.createFromString("1.3.0.1");
Expand All @@ -65,7 +65,7 @@ public void testVersionAboveMin() {
}

@Test
public void testVersionBelowMin() {
void testVersionBelowMin() {
DynawoVersion dv1 = DynawoVersion.createFromString("1.2.0");
DynawoVersion dv2 = DynawoVersion.createFromString("1");
assertEquals(1, DV_MIN.compareTo(dv1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@

import com.powsybl.dynawo.commons.loadmerge.LoadsMerger;
import com.powsybl.iidm.network.Network;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.util.List;

/**
* @author Florian Dupuy <florian.dupuy at rte-france.com>
*/
public class LoadsMergerTest extends AbstractDynawoCommonsTest {
class LoadsMergerTest extends AbstractDynawoCommonsTest {

@Test
public void multiBusesInVoltageLevel() throws IOException {
void multiBusesInVoltageLevel() throws IOException {
Network network = TestNetworkFactory.createMultiBusesVoltageLevelNetwork();
compare("/mergedLoadsMultiBusesVl.xiidm", LoadsMerger.mergeLoads(network));
}

@Test
public void mergeLoadsPpQp() throws IOException {
void mergeLoadsPpQp() throws IOException {
List<LoadState> loadStates = List.of(
new LoadState(36.1, 4.0, 36.0, 4.0),
new LoadState(10.1, 7.2, 10.3, 7.5));
Expand All @@ -35,7 +35,7 @@ public void mergeLoadsPpQp() throws IOException {
}

@Test
public void mergeLoadsPpQn() throws IOException {
void mergeLoadsPpQn() throws IOException {
List<LoadState> loadStates = List.of(
new LoadState(36.1, -4.0, 36.0, -4.0),
new LoadState(10.1, -7.2, 10.3, -7.5));
Expand All @@ -44,7 +44,7 @@ public void mergeLoadsPpQn() throws IOException {
}

@Test
public void mergeLoadsPnQn() throws IOException {
void mergeLoadsPnQn() throws IOException {
List<LoadState> loadStates = List.of(
new LoadState(-36.1, -4.0, -36.0, -4.0),
new LoadState(-10.1, -7.2, -10.3, -7.5));
Expand All @@ -53,7 +53,7 @@ public void mergeLoadsPnQn() throws IOException {
}

@Test
public void mergeLoadsPnQp() throws IOException {
void mergeLoadsPnQp() throws IOException {
List<LoadState> loadStates = List.of(
new LoadState(-36.1, 4.0, -36.0, 4.0),
new LoadState(-10.1, 7.2, -10.3, 7.5));
Expand All @@ -62,7 +62,7 @@ public void mergeLoadsPnQp() throws IOException {
}

@Test
public void mergeThreeLoadsGroups() throws IOException {
void mergeThreeLoadsGroups() throws IOException {
List<LoadState> loadStates = List.of(
new LoadState(-36.1, 4.0, -36.0, 4.0),
new LoadState(36.1, -4.0, 36.0, -4.0),
Expand All @@ -75,7 +75,7 @@ public void mergeThreeLoadsGroups() throws IOException {
}

@Test
public void nonMergeableLoads() throws IOException {
void nonMergeableLoads() throws IOException {
List<LoadState> loadStates = List.of(
new LoadState(6.1, 1.0, 36.0, 2.0),
new LoadState(-3.3, 3.0, -26.0, 3.0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
import com.powsybl.iidm.network.test.FourSubstationsNodeBreakerFactory;
import com.powsybl.iidm.xml.ExportOptions;
import com.powsybl.iidm.xml.NetworkXml;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.nio.file.Path;

/**
* @author Guillem Jané Guasch <janeg at aia.es>
*/
public class NetworkResultsUpdaterTest extends AbstractDynawoCommonsTest {
class NetworkResultsUpdaterTest extends AbstractDynawoCommonsTest {

@Test
public void testUpdateWithoutMergeLoads() throws IOException {
void testUpdateWithoutMergeLoads() throws IOException {
Network expected = TestNetworkFactory.createMultiBusesVoltageLevelNetwork();
Network actual = NetworkXml.copy(expected);
reset(actual);
Expand All @@ -31,15 +31,15 @@ public void testUpdateWithoutMergeLoads() throws IOException {
}

@Test
public void testUpdateWithMergeLoads() throws IOException {
void testUpdateWithMergeLoads() throws IOException {
Network expected = TestNetworkFactory.createMultiBusesVoltageLevelNetwork();
Network actual = NetworkXml.copy(expected);
NetworkResultsUpdater.update(actual, LoadsMerger.mergeLoads(expected), true);
compare(expected, actual);
}

@Test
public void testUpdateNetworkPassingThroughBusBreaker() throws IOException {
void testUpdateNetworkPassingThroughBusBreaker() throws IOException {
Network expected = TestNetworkFactory.createMultiBusesVoltageLevelNetwork();
Network actual = NetworkXml.copy(expected);
reset(actual);
Expand All @@ -58,7 +58,7 @@ public void testUpdateNetworkPassingThroughBusBreaker() throws IOException {
}

@Test
public void testUpdateWithDisconnects() throws IOException {
void testUpdateWithDisconnects() throws IOException {
Network expected = FourSubstationsNodeBreakerFactory.create();
Network actual = NetworkXml.copy(expected);
reset(actual);
Expand Down
4 changes: 2 additions & 2 deletions dynaflow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
26 changes: 13 additions & 13 deletions dynaflow/src/test/java/com/powsybl/dynaflow/DynaFlowConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,39 @@
import com.google.common.jimfs.Jimfs;
import com.powsybl.commons.config.InMemoryPlatformConfig;
import com.powsybl.commons.config.MapModuleConfig;
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 java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.Path;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

/**
*
* @author Guillaume Pernin <guillaume.pernin at rte-france.com>
*/
public class DynaFlowConfigTest {
class DynaFlowConfigTest {

private FileSystem fileSystem;
private final boolean debug = true;
private final String homeDir = "homeDir";

@Before
public void setUp() {
@BeforeEach
void setUp() {
fileSystem = Jimfs.newFileSystem(Configuration.windows());
}

@After
public void tearDown() throws IOException {
@AfterEach
void tearDown() throws IOException {
fileSystem.close();
}

@Test
public void fromPlatformConfigTest() {
void fromPlatformConfigTest() {
InMemoryPlatformConfig platformConfig = new InMemoryPlatformConfig(fileSystem);

MapModuleConfig moduleConfig = platformConfig.createModuleConfig("dynaflow");
Expand All @@ -55,15 +55,15 @@ public void fromPlatformConfigTest() {
}

@Test
public void fromPlatformConfigNull() {
void fromPlatformConfigNull() {
InMemoryPlatformConfig platformConfig = new InMemoryPlatformConfig(fileSystem);

DynaFlowConfig config = DynaFlowConfig.fromPlatformConfig(platformConfig);
assertNull(config);
}

@Test
public void checkGetters() {
void checkGetters() {
Path pathHomeDir = fileSystem.getPath(homeDir);
DynaFlowConfig config = new DynaFlowConfig(pathHomeDir, debug);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import com.powsybl.dynaflow.DynaFlowConstants.StartingPointMode;
import com.powsybl.dynaflow.json.DynaFlowConfigSerializer;
import com.powsybl.loadflow.LoadFlowParameters;
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 java.io.IOException;
import java.io.InputStream;
Expand All @@ -28,29 +28,29 @@

import static com.powsybl.commons.test.ComparisonUtils.compareTxt;
import static com.powsybl.dynaflow.DynaFlowProvider.MODULE_SPECIFIC_PARAMETERS;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

/**
*
* @author Guillaume Pernin <guillaume.pernin at rte-france.com>
*/
public class DynaFlowParametersTest extends AbstractConverterTest {
class DynaFlowParametersTest extends AbstractConverterTest {

private InMemoryPlatformConfig platformConfig;

@Before
@BeforeEach
public void setUp() {
fileSystem = Jimfs.newFileSystem(Configuration.unix());
platformConfig = new InMemoryPlatformConfig(fileSystem);
}

@After
@AfterEach
public void tearDown() throws IOException {
fileSystem.close();
}

@Test
public void checkParameters() {
void checkParameters() {
boolean svcRegulationOn = true;
boolean shuntRegulationOn = false;
boolean automaticSlackBusOn = true;
Expand Down Expand Up @@ -107,7 +107,7 @@ public void checkParameters() {
}

@Test
public void checkDefaultParameters() {
void checkDefaultParameters() {
LoadFlowParameters parameters = LoadFlowParameters.load(platformConfig);
DynaFlowParameters parametersExt = parameters.getExtension(DynaFlowParameters.class);
assertNotNull(parametersExt);
Expand All @@ -132,7 +132,7 @@ public void checkDefaultParameters() {
}

@Test
public void checkAllParametersAssignedToString() {
void checkAllParametersAssignedToString() {
LoadFlowParameters parameters = LoadFlowParameters.load(platformConfig);
DynaFlowParameters parametersExt = parameters.getExtension(DynaFlowParameters.class);
boolean svcRegulationOn = true;
Expand Down Expand Up @@ -191,7 +191,7 @@ public void checkAllParametersAssignedToString() {
}

@Test
public void defaultParametersSerialization() throws IOException {
void defaultParametersSerialization() throws IOException {
LoadFlowParameters lfParameters = LoadFlowParameters.load(platformConfig);
lfParameters.setNoGeneratorReactiveLimits(true);
lfParameters.setPhaseShifterRegulationOn(false);
Expand All @@ -210,7 +210,7 @@ public void defaultParametersSerialization() throws IOException {
}

@Test
public void parametersSerialization() throws IOException {
void parametersSerialization() throws IOException {
LoadFlowParameters lfParameters = LoadFlowParameters.load(platformConfig);
lfParameters.setNoGeneratorReactiveLimits(true);
lfParameters.setPhaseShifterRegulationOn(false);
Expand Down Expand Up @@ -244,7 +244,7 @@ public void parametersSerialization() throws IOException {
}

@Test
public void loadMapDynaflowParameters() {
void loadMapDynaflowParameters() {

boolean svcRegulationOn = true;
boolean shuntRegulationOn = true;
Expand Down
Loading