powsybl-core
powsybl-core copied to clipboard
[SecurityAnalysis] Assert in securityAnalysisInterceptorMock
-
Do you want to request a feature or report a bug? bug
-
What is the current behavior? java.util.concurrent.CompletionException: java.lang.AssertionError: Expected :0 Actual :5
-
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem During test, 1 / use EurostagTutorialExample1Factory.createWithFixedCurrentLimits() to generate network 2 / use the DefaultSecurityAnalysisProvider 3/ use the following code
for (String interceptorName : SecurityAnalysisInterceptors.getExtensionNames()) {
interceptors.add(SecurityAnalysisInterceptors.createInterceptor(interceptorName));
}
4 / run the test
-
What is the expected behavior? Should not throw assert exception
-
What is the motivation / use case for changing the behavior? It needed to test other network than classic Eurostag
-
Please tell us about your environment:
- PowSyBl Version: 4.3.0
@annetill @mathbagu I think there are two issues here:
- We do not specify anywhere that
SecurityAnalysisInterceptorMock
is only to be used with the eurostag network so people do not expect this behavior - We have not implemented the equivalent of
SecurityAnalysisMock
with the new API (which would make testing way easier), meaning people testing the API have no choice but to useDefaultSecurityAnalysis
which may not be appropriate for simple test
I am gonna make a PR resolving these issues if this is okay with you.
EDIT Actually, the solution might be to put all mock objects in a module security-analysis-test
. It would be cleaner and more understandable I think. What do you think? This way, security-analysis-default
is not used to test only the API.