-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fixed sorting issue in tests #70
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: David SARTORI <[email protected]>
assertFaultResultsEquals(orderedFaultResults, orderedFaultResultsDto); | ||
} | ||
|
||
private static void assertPagedFaultResultsEqualsSorted(ShortCircuitAnalysisResult result, List<org.gridsuite.shortcircuit.server.dto.FaultResult> faultResults) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to assertPagedSortedFaultResultsEquals
@@ -189,9 +189,14 @@ private static void assertResultsEquals(ShortCircuitAnalysisResult result, org.g | |||
|
|||
private static void assertPagedFaultResultsEquals(ShortCircuitAnalysisResult result, List<org.gridsuite.shortcircuit.server.dto.FaultResult> faultResults) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertResultsEquals and assertPagedFaultResultsEquals are almost the same. One should be deleted
Signed-off-by: David SARTORI <[email protected]>
c0aee83
to
db5669b
Compare
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
assertEquals(result.getFaultResults().size(), faultResults.size()); | ||
|
||
// When we do not provide sort parameter to the request, order is not guaranteed, so we sort results here to not test their order | ||
List<FaultResult> orderedFaultResults = result.getFaultResults().stream().sorted(Comparator.comparing(fr -> fr.getFault().getId())).toList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertFaultResultsEquals() and assertSortedFaultResultsEquals() should be homogeneous.
Wether you assume that the results given as "ShortCircuitAnalysisResult result" are sorted and you don't need to sort them. Wether you assume they are not sorted and you should sort them in both methods
No description provided.