7
7
import de .muenchen .dave .domain .dtos .messstelle .FahrzeugOptionsDTO ;
8
8
import de .muenchen .dave .domain .dtos .messstelle .ReadMessfaehigkeitDTO ;
9
9
import de .muenchen .dave .domain .dtos .messstelle .ValidateZeitraumAndTagestypForMessstelleDTO ;
10
+ import de .muenchen .dave .domain .enums .AuswertungsZeitraum ;
10
11
import de .muenchen .dave .domain .enums .Fahrzeugklasse ;
11
12
import de .muenchen .dave .domain .enums .TagesTyp ;
12
13
import de .muenchen .dave .domain .model .messstelle .ValidateZeitraumAndTagesTypForMessstelleModel ;
13
14
import de .muenchen .dave .services .KalendertagService ;
14
15
import java .time .LocalDate ;
16
+ import java .time .YearMonth ;
15
17
import java .util .ArrayList ;
16
18
import java .util .List ;
17
19
import lombok .extern .slf4j .Slf4j ;
@@ -143,6 +145,10 @@ void isZeitraumAndTagestypValidLessThanTwoUnauffaelligeTageAndLessThenFiftyPerce
143
145
@ Test
144
146
void areZeitraeumeAndTagesTypForMessstelleValidWithMoreThanTwoUnauffaelligeTageAndMoreThanFiftyPercentUnauffaelligeTage () {
145
147
final var mstId = "1234" ;
148
+ final var zeitraumAuswertung = new Zeitraum (
149
+ YearMonth .of (2008 , 1 ),
150
+ YearMonth .of (2008 , 3 ),
151
+ AuswertungsZeitraum .QUARTAL_1 );
146
152
final var zeitraeume = List .of (
147
153
List .of (LocalDate .of (2008 , 1 , 1 ), LocalDate .of (2008 , 1 , 31 )),
148
154
List .of (LocalDate .of (2008 , 2 , 1 ), LocalDate .of (2008 , 2 , 28 )));
@@ -151,16 +157,9 @@ void areZeitraeumeAndTagesTypForMessstelleValidWithMoreThanTwoUnauffaelligeTageA
151
157
Mockito .when (
152
158
kalendertagService .countAllKalendertageByDatumAndTagestypen (
153
159
LocalDate .of (2008 , 1 , 1 ),
154
- LocalDate .of (2008 , 1 , 31 ),
160
+ LocalDate .of (2008 , 3 , 31 ),
155
161
TagesTyp .getIncludedTagestypen (TagesTyp .WERKTAG_MO_FR )))
156
- .thenReturn (10L );
157
-
158
- Mockito .when (
159
- kalendertagService .countAllKalendertageByDatumAndTagestypen (
160
- LocalDate .of (2008 , 2 , 1 ),
161
- LocalDate .of (2008 , 2 , 28 ),
162
- TagesTyp .getIncludedTagestypen (TagesTyp .WERKTAG_MO_FR )))
163
- .thenReturn (11L );
162
+ .thenReturn (21L );
164
163
165
164
Mockito .when (unauffaelligeTageService .countAllUnauffaelligetageByMstIdAndTimerangeAndTagestypen (
166
165
mstId ,
@@ -174,7 +173,7 @@ void areZeitraeumeAndTagesTypForMessstelleValidWithMoreThanTwoUnauffaelligeTageA
174
173
LocalDate .of (2008 , 2 , 28 ),
175
174
TagesTyp .getIncludedTagestypen (TagesTyp .WERKTAG_MO_FR ))).thenReturn (6L );
176
175
177
- final var result = validierungService .areZeitraeumeAndTagesTypForMessstelleValid (mstId , zeitraeume , tagesTyp );
176
+ final var result = validierungService .areZeitraeumeAndTagesTypForMessstelleValid (mstId , zeitraumAuswertung , zeitraeume , tagesTyp );
178
177
179
178
final var expected = new ValidierungService .ValidationResult ();
180
179
expected .setValid (true );
@@ -186,6 +185,10 @@ void areZeitraeumeAndTagesTypForMessstelleValidWithMoreThanTwoUnauffaelligeTageA
186
185
@ Test
187
186
void areZeitraeumeAndTagesTypForMessstelleValidWithMoreThanTwoUnauffaelligeTageAndLessThenFiftyPercentUnauffaelligeTage () {
188
187
final var mstId = "1234" ;
188
+ final var zeitraumAuswertung = new Zeitraum (
189
+ YearMonth .of (2008 , 1 ),
190
+ YearMonth .of (2008 , 3 ),
191
+ AuswertungsZeitraum .QUARTAL_1 );
189
192
final var zeitraeume = List .of (
190
193
List .of (LocalDate .of (2008 , 1 , 1 ), LocalDate .of (2008 , 1 , 31 )),
191
194
List .of (LocalDate .of (2008 , 2 , 1 ), LocalDate .of (2008 , 2 , 28 )));
@@ -194,16 +197,9 @@ void areZeitraeumeAndTagesTypForMessstelleValidWithMoreThanTwoUnauffaelligeTageA
194
197
Mockito .when (
195
198
kalendertagService .countAllKalendertageByDatumAndTagestypen (
196
199
LocalDate .of (2008 , 1 , 1 ),
197
- LocalDate .of (2008 , 1 , 31 ),
198
- TagesTyp .getIncludedTagestypen (TagesTyp .WERKTAG_MO_FR )))
199
- .thenReturn (10L );
200
-
201
- Mockito .when (
202
- kalendertagService .countAllKalendertageByDatumAndTagestypen (
203
- LocalDate .of (2008 , 2 , 1 ),
204
- LocalDate .of (2008 , 2 , 28 ),
200
+ LocalDate .of (2008 , 3 , 31 ),
205
201
TagesTyp .getIncludedTagestypen (TagesTyp .WERKTAG_MO_FR )))
206
- .thenReturn (11L );
202
+ .thenReturn (21L );
207
203
208
204
Mockito .when (unauffaelligeTageService .countAllUnauffaelligetageByMstIdAndTimerangeAndTagestypen (
209
205
mstId ,
@@ -217,7 +213,7 @@ void areZeitraeumeAndTagesTypForMessstelleValidWithMoreThanTwoUnauffaelligeTageA
217
213
LocalDate .of (2008 , 2 , 28 ),
218
214
TagesTyp .getIncludedTagestypen (TagesTyp .WERKTAG_MO_FR ))).thenReturn (5L );
219
215
220
- final var result = validierungService .areZeitraeumeAndTagesTypForMessstelleValid (mstId , zeitraeume , tagesTyp );
216
+ final var result = validierungService .areZeitraeumeAndTagesTypForMessstelleValid (mstId , zeitraumAuswertung , zeitraeume , tagesTyp );
221
217
222
218
final var expected = new ValidierungService .ValidationResult ();
223
219
expected .setValid (false );
@@ -229,6 +225,10 @@ void areZeitraeumeAndTagesTypForMessstelleValidWithMoreThanTwoUnauffaelligeTageA
229
225
@ Test
230
226
void areZeitraeumeAndTagesTypForMessstelleValidWithLessThanTwoUnauffaelligeTageAndMoreThenFiftyPercentUnauffaelligeTage () {
231
227
final var mstId = "1234" ;
228
+ final var zeitraumAuswertung = new Zeitraum (
229
+ YearMonth .of (2008 , 1 ),
230
+ YearMonth .of (2008 , 3 ),
231
+ AuswertungsZeitraum .QUARTAL_1 );
232
232
final var zeitraeume = List .of (
233
233
List .of (LocalDate .of (2008 , 1 , 1 ), LocalDate .of (2008 , 1 , 31 )),
234
234
List .of (LocalDate .of (2008 , 2 , 1 ), LocalDate .of (2008 , 2 , 28 )));
@@ -237,17 +237,10 @@ void areZeitraeumeAndTagesTypForMessstelleValidWithLessThanTwoUnauffaelligeTageA
237
237
Mockito .when (
238
238
kalendertagService .countAllKalendertageByDatumAndTagestypen (
239
239
LocalDate .of (2008 , 1 , 1 ),
240
- LocalDate .of (2008 , 1 , 31 ),
240
+ LocalDate .of (2008 , 3 , 31 ),
241
241
TagesTyp .getIncludedTagestypen (TagesTyp .WERKTAG_MO_FR )))
242
242
.thenReturn (1L );
243
243
244
- Mockito .when (
245
- kalendertagService .countAllKalendertageByDatumAndTagestypen (
246
- LocalDate .of (2008 , 2 , 1 ),
247
- LocalDate .of (2008 , 2 , 28 ),
248
- TagesTyp .getIncludedTagestypen (TagesTyp .WERKTAG_MO_FR )))
249
- .thenReturn (0L );
250
-
251
244
Mockito .when (unauffaelligeTageService .countAllUnauffaelligetageByMstIdAndTimerangeAndTagestypen (
252
245
mstId ,
253
246
LocalDate .of (2008 , 1 , 1 ),
@@ -260,7 +253,7 @@ void areZeitraeumeAndTagesTypForMessstelleValidWithLessThanTwoUnauffaelligeTageA
260
253
LocalDate .of (2008 , 2 , 28 ),
261
254
TagesTyp .getIncludedTagestypen (TagesTyp .WERKTAG_MO_FR ))).thenReturn (0L );
262
255
263
- final var result = validierungService .areZeitraeumeAndTagesTypForMessstelleValid (mstId , zeitraeume , tagesTyp );
256
+ final var result = validierungService .areZeitraeumeAndTagesTypForMessstelleValid (mstId , zeitraumAuswertung , zeitraeume , tagesTyp );
264
257
265
258
final var expected = new ValidierungService .ValidationResult ();
266
259
expected .setValid (false );
@@ -272,6 +265,10 @@ void areZeitraeumeAndTagesTypForMessstelleValidWithLessThanTwoUnauffaelligeTageA
272
265
@ Test
273
266
void areZeitraeumeAndTagesTypForMessstelleValidWithLessThanTwoUnauffaelligeTageAndLessThenFiftyPercentUnauffaelligeTage () {
274
267
final var mstId = "1234" ;
268
+ final var zeitraumAuswertung = new Zeitraum (
269
+ YearMonth .of (2008 , 1 ),
270
+ YearMonth .of (2008 , 3 ),
271
+ AuswertungsZeitraum .QUARTAL_1 );
275
272
final var zeitraeume = List .of (
276
273
List .of (LocalDate .of (2008 , 1 , 1 ), LocalDate .of (2008 , 1 , 31 )),
277
274
List .of (LocalDate .of (2008 , 2 , 1 ), LocalDate .of (2008 , 2 , 28 )));
@@ -280,16 +277,9 @@ void areZeitraeumeAndTagesTypForMessstelleValidWithLessThanTwoUnauffaelligeTageA
280
277
Mockito .when (
281
278
kalendertagService .countAllKalendertageByDatumAndTagestypen (
282
279
LocalDate .of (2008 , 1 , 1 ),
283
- LocalDate .of (2008 , 1 , 31 ),
284
- TagesTyp .getIncludedTagestypen (TagesTyp .WERKTAG_MO_FR )))
285
- .thenReturn (1L );
286
-
287
- Mockito .when (
288
- kalendertagService .countAllKalendertageByDatumAndTagestypen (
289
- LocalDate .of (2008 , 2 , 1 ),
290
- LocalDate .of (2008 , 2 , 28 ),
280
+ LocalDate .of (2008 , 3 , 31 ),
291
281
TagesTyp .getIncludedTagestypen (TagesTyp .WERKTAG_MO_FR )))
292
- .thenReturn (2L );
282
+ .thenReturn (3L );
293
283
294
284
Mockito .when (unauffaelligeTageService .countAllUnauffaelligetageByMstIdAndTimerangeAndTagestypen (
295
285
mstId ,
@@ -303,7 +293,7 @@ void areZeitraeumeAndTagesTypForMessstelleValidWithLessThanTwoUnauffaelligeTageA
303
293
LocalDate .of (2008 , 2 , 28 ),
304
294
TagesTyp .getIncludedTagestypen (TagesTyp .WERKTAG_MO_FR ))).thenReturn (0L );
305
295
306
- final var result = validierungService .areZeitraeumeAndTagesTypForMessstelleValid (mstId , zeitraeume , tagesTyp );
296
+ final var result = validierungService .areZeitraeumeAndTagesTypForMessstelleValid (mstId , zeitraumAuswertung , zeitraeume , tagesTyp );
307
297
308
298
final var expected = new ValidierungService .ValidationResult ();
309
299
expected .setValid (false );
0 commit comments