@@ -30,10 +30,10 @@ void testBuildSimpleGeneratorConstraints() {
30
30
.withLagTime (2. )
31
31
.build ();
32
32
assertEquals ("generator" , generatorConstraints .getGeneratorId ());
33
- assertEquals (400. , generatorConstraints .getPMin ());
34
- assertEquals (1000. , generatorConstraints .getPMax ());
35
- assertEquals (1. , generatorConstraints .getLeadTime ());
36
- assertEquals (2. , generatorConstraints .getLagTime ());
33
+ assertEquals (Optional . of ( 400. ) , generatorConstraints .getPMin ());
34
+ assertEquals (Optional . of ( 1000. ) , generatorConstraints .getPMax ());
35
+ assertEquals (Optional . of ( 1. ) , generatorConstraints .getLeadTime ());
36
+ assertEquals (Optional . of ( 2. ) , generatorConstraints .getLagTime ());
37
37
assertTrue (generatorConstraints .getMinUpTime ().isEmpty ());
38
38
assertTrue (generatorConstraints .getMaxUpTime ().isEmpty ());
39
39
assertTrue (generatorConstraints .getMinOffTime ().isEmpty ());
@@ -56,10 +56,10 @@ void testBuildComprehensiveGeneratorConstraints() {
56
56
.withDownwardPowerGradient (-100. )
57
57
.build ();
58
58
assertEquals ("generator" , generatorConstraints .getGeneratorId ());
59
- assertEquals (400. , generatorConstraints .getPMin ());
60
- assertEquals (1000. , generatorConstraints .getPMax ());
61
- assertEquals (1. , generatorConstraints .getLeadTime ());
62
- assertEquals (2. , generatorConstraints .getLagTime ());
59
+ assertEquals (Optional . of ( 400. ) , generatorConstraints .getPMin ());
60
+ assertEquals (Optional . of ( 1000. ) , generatorConstraints .getPMax ());
61
+ assertEquals (Optional . of ( 1. ) , generatorConstraints .getLeadTime ());
62
+ assertEquals (Optional . of ( 2. ) , generatorConstraints .getLagTime ());
63
63
assertEquals (Optional .of (4. ), generatorConstraints .getMinUpTime ());
64
64
assertEquals (Optional .of (6.5 ), generatorConstraints .getMaxUpTime ());
65
65
assertEquals (Optional .of (3. ), generatorConstraints .getMinOffTime ());
@@ -68,28 +68,9 @@ void testBuildComprehensiveGeneratorConstraints() {
68
68
}
69
69
70
70
@ Test
71
- void testBuildWithMissingData () {
72
- OpenRaoException exception ;
73
-
74
- // missing id
75
- exception = assertThrows (OpenRaoException .class , () -> GeneratorConstraints .create ().withPMin (400. ).withPMax (1000. ).withLeadTime (1. ).withLagTime (1. ).build ());
71
+ void testBuildWithMissingId () {
72
+ OpenRaoException exception = assertThrows (OpenRaoException .class , () -> GeneratorConstraints .create ().withPMin (400. ).withPMax (1000. ).withLeadTime (1. ).withLagTime (1. ).build ());
76
73
assertEquals ("The id of the generator is mandatory." , exception .getMessage ());
77
-
78
- // missing pMin
79
- exception = assertThrows (OpenRaoException .class , () -> GeneratorConstraints .create ().withGeneratorId ("generator" ).withPMax (1000. ).withLeadTime (1. ).withLagTime (1. ).build ());
80
- assertEquals ("The pMin of the generator is mandatory." , exception .getMessage ());
81
-
82
- // missing pMax
83
- exception = assertThrows (OpenRaoException .class , () -> GeneratorConstraints .create ().withGeneratorId ("generator" ).withPMin (400. ).withLeadTime (1. ).withLagTime (1. ).build ());
84
- assertEquals ("The pMax of the generator is mandatory." , exception .getMessage ());
85
-
86
- // missing lead time
87
- exception = assertThrows (OpenRaoException .class , () -> GeneratorConstraints .create ().withGeneratorId ("generator" ).withPMin (400. ).withPMax (1000. ).withLagTime (1. ).build ());
88
- assertEquals ("The lead time of the generator is mandatory." , exception .getMessage ());
89
-
90
- // missing lag time
91
- exception = assertThrows (OpenRaoException .class , () -> GeneratorConstraints .create ().withGeneratorId ("generator" ).withPMin (400. ).withPMax (1000. ).withLeadTime (1. ).build ());
92
- assertEquals ("The lag time of the generator is mandatory." , exception .getMessage ());
93
74
}
94
75
95
76
@ Test
@@ -98,6 +79,12 @@ void testNegativePMin() {
98
79
assertEquals ("The minimal power of the generator must be positive." , exception .getMessage ());
99
80
}
100
81
82
+ @ Test
83
+ void testNegativePMax () {
84
+ OpenRaoException exception = assertThrows (OpenRaoException .class , () -> GeneratorConstraints .create ().withGeneratorId ("generator" ).withPMax (-200. ).withLeadTime (1. ).withLagTime (1. ).build ());
85
+ assertEquals ("The maximal power of the generator must be positive." , exception .getMessage ());
86
+ }
87
+
101
88
@ Test
102
89
void testPMaxLowerThanPMin () {
103
90
OpenRaoException exception = assertThrows (OpenRaoException .class , () -> GeneratorConstraints .create ().withGeneratorId ("generator" ).withPMin (400. ).withPMax (300. ).withLeadTime (1. ).withLagTime (1. ).build ());
0 commit comments