15
15
import org .gridsuite .securityanalysis .server .entities .AbstractLimitViolationEntity ;
16
16
import org .gridsuite .securityanalysis .server .entities .SubjectLimitViolationEntity ;
17
17
import org .junit .jupiter .api .Test ;
18
- import org .springframework .boot .test .context .SpringBootTest ;
19
18
20
19
import static com .powsybl .iidm .network .test .EurostagTutorialExample1Factory .NGEN_NHV1 ;
21
20
import static com .powsybl .iidm .network .test .EurostagTutorialExample1Factory .NHV1_NHV2_1 ;
24
23
/**
25
24
* @author Caroline Jeandat <caroline.jeandat at rte-france.com>
26
25
*/
27
- @ SpringBootTest
28
- abstract class AbstractLimitViolationTest {
26
+ abstract class AbstractLimitViolationTest <T extends AbstractLimitViolationEntity > {
29
27
30
28
@ Test
31
- void testAbstractLimitViolationEntityNewFields () {
32
- testAbstractLimitViolationMapping ("10'" , 10 * 60 , 1200 , 1 , 1250 , TwoSides .TWO , "1'" , 1100 , 10 * 60 , null );
29
+ void testLimitViolationEntityNewFields () {
30
+ testLimitViolationMapping ("10'" , 10 * 60 , 1200 , 1 , 1250 , TwoSides .TWO , "1'" , 1100 , 10 * 60 , null );
33
31
}
34
32
35
33
@ Test
36
- void testAbstractLimitViolationEntityNewFieldsWithPermanentLimitReached () {
37
- testAbstractLimitViolationMapping (LimitViolationUtils .PERMANENT_LIMIT_NAME , Integer .MAX_VALUE , 1100 , 1 , 1150 ,
34
+ void testLimitViolationEntityNewFieldsWithPermanentLimitReached () {
35
+ testLimitViolationMapping (LimitViolationUtils .PERMANENT_LIMIT_NAME , Integer .MAX_VALUE , 1100 , 1 , 1150 ,
38
36
TwoSides .TWO , "10'" , 1100 , Integer .MAX_VALUE , null );
39
37
}
40
38
41
39
@ Test
42
- void testAbstractLimitViolationEntityNewFieldsWithPermanentLimitReachedAndNoTemporaryLimit () {
43
- testAbstractLimitViolationMapping (LimitViolationUtils .PERMANENT_LIMIT_NAME , Integer .MAX_VALUE , 500 , 1 , 1000 ,
40
+ void testLimitViolationEntityNewFieldsWithPermanentLimitReachedAndNoTemporaryLimit () {
41
+ testLimitViolationMapping (LimitViolationUtils .PERMANENT_LIMIT_NAME , Integer .MAX_VALUE , 500 , 1 , 1000 ,
44
42
TwoSides .ONE , null , 500 , Integer .MAX_VALUE , null );
45
43
}
46
44
47
45
@ Test
48
- void testAbstractLimitViolationEntityNewFieldsWithLastLimitReached () {
49
- testAbstractLimitViolationMapping ("N/A" , 0 , 1100 , 1 , 3000 , TwoSides .TWO , null , 1100 , 0 , null );
46
+ void testLimitViolationEntityNewFieldsWithLastLimitReached () {
47
+ testLimitViolationMapping ("N/A" , 0 , 1100 , 1 , 3000 , TwoSides .TWO , null , 1100 , 0 , null );
50
48
}
51
49
52
50
@ Test
53
- void testAbstractLimitViolationEntityNewFieldsWithLimitReductionEffective () {
51
+ void testLimitViolationEntityNewFieldsWithLimitReductionEffective () {
54
52
// for this test to be relevant, "value" needs to be less that "limit"
55
- testAbstractLimitViolationMapping ("10'" , 60 , 1200 , 0.8 , 1150 , TwoSides .TWO , "1'" , 1100 , 10 * 60 , 60 );
53
+ testLimitViolationMapping ("10'" , 60 , 1200 , 0.8 , 1150 , TwoSides .TWO , "1'" , 1100 , 10 * 60 , 60 );
56
54
}
57
55
58
56
@ Test
59
- void test2wtContingencyLimitViolationEntityNewFieldsWithLimitReductionEffective () {
57
+ void test2wtLimitViolationEntityNewFieldsWithLimitReductionEffective () {
60
58
// for this test to be relevant, "value" needs to be less that "limit"
61
59
Network network = EurostagTutorialExample1Factory .createWithFixedCurrentLimits ();
62
60
// create limit set for two windings transformer
@@ -96,7 +94,7 @@ void test2wtContingencyLimitViolationEntityNewFieldsWithLimitReductionEffective(
96
94
limitViolationEntity .getPatlLoading ());
97
95
}
98
96
99
- private void testAbstractLimitViolationMapping (String limitName , int acceptableDuration , double limit ,
97
+ private void testLimitViolationMapping (String limitName , int acceptableDuration , double limit ,
100
98
double limitReduction , double value , TwoSides side , String expectedNextLimitName , long expectedPatlLimit ,
101
99
Integer expectedAcceptableDuration , Integer expectedUpcomingAcceptableDuration ) {
102
100
Network network = EurostagTutorialExample1Factory .createWithFixedCurrentLimits ();
@@ -106,7 +104,7 @@ private void testAbstractLimitViolationMapping(String limitName, int acceptableD
106
104
SubjectLimitViolationEntity subjectLimitViolationEntity = new SubjectLimitViolationEntity (NHV1_NHV2_1 ,
107
105
"NHV1_NHV2_1_name" );
108
106
109
- AbstractLimitViolationEntity limitViolationEntity = createLimitViolationEntity (network , limitViolation ,
107
+ T limitViolationEntity = createLimitViolationEntity (network , limitViolation ,
110
108
subjectLimitViolationEntity );
111
109
112
110
assertEquals (expectedNextLimitName , limitViolationEntity .getNextLimitName ());
@@ -117,6 +115,6 @@ private void testAbstractLimitViolationMapping(String limitName, int acceptableD
117
115
limitViolationEntity .getPatlLoading ());
118
116
}
119
117
120
- protected abstract AbstractLimitViolationEntity createLimitViolationEntity (Network network ,
118
+ protected abstract T createLimitViolationEntity (Network network ,
121
119
LimitViolation limitViolation , SubjectLimitViolationEntity subjectLimitViolationEntity );
122
120
}
0 commit comments