@@ -324,16 +324,17 @@ private static Stream<Arguments> voltageLevelRuleData() {
324
324
325
325
@ ParameterizedTest
326
326
@ MethodSource ("fieldTypeData" )
327
- void shouldReturnCorrectFieldTypes (String methodType , EquipmentType equipmentType , List <FieldType > expectedFields ) {
328
- switch (methodType ) {
329
- case "nominal" -> when (filterService .getNominalVoltageFieldType (any ())).thenCallRealMethod ();
330
- case "country" -> when (filterService .getCountryCodeFieldType (any ())).thenCallRealMethod ();
331
- case "substation" -> when (filterService .getSubstationPropertiesFieldTypes (any ())).thenCallRealMethod ();
327
+ void shouldReturnCorrectFieldTypes (String category , EquipmentType equipmentType , List <FieldType > expectedFields ) {
328
+ switch (category ) {
329
+ case GlobalFilter .Fields .nominalV -> when (filterService .getNominalVoltageFieldType (any ())).thenCallRealMethod ();
330
+ case GlobalFilter .Fields .countryCode -> when (filterService .getCountryCodeFieldType (any ())).thenCallRealMethod ();
331
+ case GlobalFilter .Fields .substationProperty -> when (filterService .getSubstationPropertiesFieldTypes (any ())).thenCallRealMethod ();
332
+ default -> throw new IllegalArgumentException ("Unknown category: " + category );
332
333
}
333
- List <FieldType > result = switch (methodType ) {
334
- case "nominal" -> filterService .getNominalVoltageFieldType (equipmentType );
335
- case "country" -> filterService .getCountryCodeFieldType (equipmentType );
336
- case "substation" -> filterService .getSubstationPropertiesFieldTypes (equipmentType );
334
+ List <FieldType > result = switch (category ) {
335
+ case GlobalFilter . Fields . nominalV -> filterService .getNominalVoltageFieldType (equipmentType );
336
+ case GlobalFilter . Fields . countryCode -> filterService .getCountryCodeFieldType (equipmentType );
337
+ case GlobalFilter . Fields . substationProperty -> filterService .getSubstationPropertiesFieldTypes (equipmentType );
337
338
default -> Collections .emptyList ();
338
339
};
339
340
assertEquals (expectedFields , result );
@@ -342,20 +343,20 @@ void shouldReturnCorrectFieldTypes(String methodType, EquipmentType equipmentTyp
342
343
private static Stream <Arguments > fieldTypeData () {
343
344
return Stream .of (
344
345
// Nominal voltage
345
- Arguments .of ("nominal" , EquipmentType .LINE , List .of (FieldType .NOMINAL_VOLTAGE_1 , FieldType .NOMINAL_VOLTAGE_2 )),
346
- Arguments .of ("nominal" , EquipmentType .TWO_WINDINGS_TRANSFORMER , List .of (FieldType .NOMINAL_VOLTAGE_1 , FieldType .NOMINAL_VOLTAGE_2 )),
347
- Arguments .of ("nominal" , EquipmentType .VOLTAGE_LEVEL , List .of (FieldType .NOMINAL_VOLTAGE )),
348
- Arguments .of ("nominal" , EquipmentType .GENERATOR , Collections .emptyList ()),
346
+ Arguments .of (GlobalFilter . Fields . nominalV , EquipmentType .LINE , List .of (FieldType .NOMINAL_VOLTAGE_1 , FieldType .NOMINAL_VOLTAGE_2 )),
347
+ Arguments .of (GlobalFilter . Fields . nominalV , EquipmentType .TWO_WINDINGS_TRANSFORMER , List .of (FieldType .NOMINAL_VOLTAGE_1 , FieldType .NOMINAL_VOLTAGE_2 )),
348
+ Arguments .of (GlobalFilter . Fields . nominalV , EquipmentType .VOLTAGE_LEVEL , List .of (FieldType .NOMINAL_VOLTAGE )),
349
+ Arguments .of (GlobalFilter . Fields . nominalV , EquipmentType .GENERATOR , Collections .emptyList ()),
349
350
350
351
// Country code
351
- Arguments .of ("country" , EquipmentType .VOLTAGE_LEVEL , List .of (FieldType .COUNTRY )),
352
- Arguments .of ("country" , EquipmentType .TWO_WINDINGS_TRANSFORMER , List .of (FieldType .COUNTRY )),
353
- Arguments .of ("country" , EquipmentType .LINE , List .of (FieldType .COUNTRY_1 , FieldType .COUNTRY_2 )),
354
- Arguments .of ("country" , EquipmentType .GENERATOR , Collections .emptyList ()),
352
+ Arguments .of (GlobalFilter . Fields . countryCode , EquipmentType .VOLTAGE_LEVEL , List .of (FieldType .COUNTRY )),
353
+ Arguments .of (GlobalFilter . Fields . countryCode , EquipmentType .TWO_WINDINGS_TRANSFORMER , List .of (FieldType .COUNTRY )),
354
+ Arguments .of (GlobalFilter . Fields . countryCode , EquipmentType .LINE , List .of (FieldType .COUNTRY_1 , FieldType .COUNTRY_2 )),
355
+ Arguments .of (GlobalFilter . Fields . countryCode , EquipmentType .GENERATOR , Collections .emptyList ()),
355
356
356
357
// Substation properties
357
- Arguments .of ("substation" , EquipmentType .LINE , List .of (FieldType .SUBSTATION_PROPERTIES_1 , FieldType .SUBSTATION_PROPERTIES_2 )),
358
- Arguments .of ("substation" , EquipmentType .GENERATOR , List .of (FieldType .SUBSTATION_PROPERTIES ))
358
+ Arguments .of (GlobalFilter . Fields . substationProperty , EquipmentType .LINE , List .of (FieldType .SUBSTATION_PROPERTIES_1 , FieldType .SUBSTATION_PROPERTIES_2 )),
359
+ Arguments .of (GlobalFilter . Fields . substationProperty , EquipmentType .GENERATOR , List .of (FieldType .SUBSTATION_PROPERTIES ))
359
360
);
360
361
}
361
362
0 commit comments