Conversation
Simplified the logic for multi-line mappings by restructuring the test case to use streamlined mapping methods and improved assertions. Added clear `Given-When-Then` test structure, enhancing code readability and maintainability.
Replaced direct access to elementName with Optional to prevent potential null pointer exceptions. This ensures safer handling when retrieving and processing the property from networkMarketBased. Default values are used if elementName is absent.
# Conflicts: # src/test/java/com/rte_france/trm_algorithm/UcteMappingTest.java
|
@murgeyseb FYI |
terriervik
left a comment
There was a problem hiding this comment.
Thanks for the PR, please see my comments
| @@ -0,0 +1,87 @@ | |||
| /* | |||
| * Copyright (c) 2024, RTE (http://www.rte-france.com) | |||
There was a problem hiding this comment.
Should this copyright be 2025 (same for all new classes in this PR)?
(@murgeyseb I don't know the correct policy)
| } | ||
|
|
||
| @Test | ||
| void testRealNetwork() { |
There was a problem hiding this comment.
This method should be deleted.
| } | ||
|
|
||
| @Test | ||
| void testNewMappingMap() { |
There was a problem hiding this comment.
Add a test to this method (assertSomething), or delete it.
| new MappingResults("FFNHV311 FFNHV211 1", "FFNHV211 FFNHV311 1", true), | ||
| new MappingResults("FFNGEN71 FFNHV111 1", "FFNGEN71 FFNHV111 1", true), | ||
| new MappingResults("FFNHV211 FFNLOA31 L", "FFNHV211 FFNLOA31 L", true)); | ||
| //assertEquals(expectedMappingResults, mappingResults.mappingResults()); |
There was a problem hiding this comment.
You should add an assertSomething at the end of this method, otherwise it is not a test.
| * @author Sebastian Huaraca {@literal <sebastian.huaracalapa at rte-france.com>} | ||
| */ | ||
|
|
||
| public class UcteMappingTest { |
There was a problem hiding this comment.
A general comment on this test class: could you please describe (in comments) what you precisely test in each method?
In particular, I am curious to see written which test method checks the following functionalities:
A/ same substation code (first 7 characters) for side 1 and for side 2 + same order code
B/ same substation code (first 7 characters) for side 1 and for side 2, both sides are inverted between the files + same order code
C/ A and B, but with different order code and same element name
D/ Line from network 1 missing in network 2
E/ Line from network 1 pointing at several elements from network 2
F/ others, if I forgot something :)
| .filter(branchId -> Objects.isNull(marketBasedNetwork.getBranch(branchId))) | ||
| .sorted() | ||
| .toList(); | ||
| .filter(branchId -> Objects.isNull(marketBasedNetwork.getBranch(branchId))) |
There was a problem hiding this comment.
Delete this whitespaces added on lines 51 to 53 and 72 to 79
| } | ||
| } | ||
|
|
||
| private static String getOrderCode(String id) { |
There was a problem hiding this comment.
What happen if the id does not respect UCTE formet (e.g. modified network using script, or CGMES based network). Fail ?
OpenSuze
left a comment
There was a problem hiding this comment.
Could you add some documentation in doc/algorithm.md ?
| <groupId>com.powsybl</groupId> | ||
| <artifactId>open-rao-crac-io-commons</artifactId> | ||
| <version>${powsybl.rao.version}</version> | ||
| <scope>test</scope> |
There was a problem hiding this comment.
Could you add the default scope and move this dependency into its section (in alphabetical order: line 83 I think) ?
| .filter(branchId -> Objects.isNull(marketBasedNetwork.getBranch(branchId))) | ||
| .sorted() | ||
| .toList(); | ||
| .filter(branchId -> Objects.isNull(marketBasedNetwork.getBranch(branchId))) |
There was a problem hiding this comment.
File not used in tests ? Add a test or remove this file
There was a problem hiding this comment.
Why is there a test file in the ressources ?
There was a problem hiding this comment.
Add this image in the test documentation
Removed unnecessary blank line for cleaner code. Adjusted indentation in lambda function for better readability and consistency.
Removed unnecessary blank line for cleaner code. Adjusted indentation in lambda function for better readability and consistency.

No description provided.