Skip to content

Commit

Permalink
Fix sonar
Browse files Browse the repository at this point in the history
Signed-off-by: Tristan Chuine <[email protected]>
  • Loading branch information
Tristan-WorkGH committed Oct 17, 2024
1 parent e893599 commit 1572dd9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;

public class GeoDataServiceTest {
class GeoDataServiceTest {
private static final String BASE_URI = "http://geo-data-server/";

@Mock
Expand Down
22 changes: 10 additions & 12 deletions src/test/java/com/powsybl/sld/server/SingleLineDiagramTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand All @@ -73,7 +72,7 @@
*/
@WebMvcTest(SingleLineDiagramController.class)
@ContextConfiguration(classes = {SingleLineDiagramApplication.class})
public class SingleLineDiagramTest {
class SingleLineDiagramTest {

@Autowired
private MockMvc mvc;
Expand Down Expand Up @@ -103,7 +102,7 @@ public class SingleLineDiagramTest {
void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
fileSystem = Jimfs.newFileSystem(Configuration.unix());
final Path tmpDir = Files.createDirectory(fileSystem.getPath("tmp"));
Files.createDirectory(fileSystem.getPath("tmp"));
}

@AfterEach
Expand Down Expand Up @@ -287,7 +286,7 @@ void testComponentLibraries() throws Exception {
private static final String GEO_DATA_SUBSTATIONS = "/geo_data_substations.json";

@Test
void testAssignSubstationGeoData() throws Exception {
void testAssignSubstationGeoData() {
UUID testNetworkId = UUID.fromString("7928181c-7977-4592-ba19-88027e4254e4");
given(networkStoreService.getNetwork(testNetworkId, PreloadingStrategy.COLLECTION)).willReturn(createNetwork());
Network network = networkStoreService.getNetwork(testNetworkId, PreloadingStrategy.COLLECTION);
Expand Down Expand Up @@ -591,14 +590,14 @@ private static String toString(String resourceName) throws IOException {
/*
#TODO replace it with already configured FourSubstationsNodeBreakerWithExtensionsFactory when migrating to next powsybl release
*/
public Network createNetworkWithTwoInjectionAndOneBranchAndOne3twt() {
private static Network createNetworkWithTwoInjectionAndOneBranchAndOne3twt() {
Network network = Network.create("TestSingleLineDiagram", "test");
Substation substation = createSubstation(network, "s", "s", Country.FR);
Substation substation2 = createSubstation(network, "s2", "s2", Country.FR);
VoltageLevel vl1 = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10);
VoltageLevel vl2 = createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 30);
VoltageLevel vl3 = createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 225, 30);
VoltageLevel vl4 = createVoltageLevel(substation2, "vl4", "vl4", TopologyKind.NODE_BREAKER, 220, 20);
VoltageLevel vl1 = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380);
VoltageLevel vl2 = createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225);
VoltageLevel vl3 = createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 225);
VoltageLevel vl4 = createVoltageLevel(substation2, "vl4", "vl4", TopologyKind.NODE_BREAKER, 220);

createBusBarSection(vl1, "bbs11", "bbs11", 2, 2, 2);
createLoad(vl1, "loadA", "loadA", "loadA", 0, ConnectablePosition.Direction.TOP, 4, 10, 10);
Expand Down Expand Up @@ -636,14 +635,13 @@ private static Substation createSubstation(Network n, String id, String name, Co
.add();
}

private static VoltageLevel createVoltageLevel(Substation s, String id, String name, TopologyKind topology, double vNom, int nodeCount) {
VoltageLevel vl = s.newVoltageLevel()
private static VoltageLevel createVoltageLevel(Substation s, String id, String name, TopologyKind topology, double vNom) {
return s.newVoltageLevel()
.setId(id)
.setName(name)
.setTopologyKind(topology)
.setNominalV(vNom)
.add();
return vl;
}

private static void createLoad(VoltageLevel vl, String id, String name, String feederName, Integer feederOrder,
Expand Down

0 comments on commit 1572dd9

Please sign in to comment.