@@ -302,7 +302,7 @@ void getControlBlocksForMatchingFCDA_should_return_expected_Items(LN0 ln0, TServ
302
302
List <ControlBlock > controlBlocks = ln0Adapter .getControlBlocksForMatchingFCDA (extRefInfo ).toList ();
303
303
// Then
304
304
assertThat (controlBlocks ).hasSize (1 );
305
- assertThat (controlBlocks .get ( 0 ).getServiceType ()).isEqualTo (serviceType );
305
+ assertThat (controlBlocks .getFirst ( ).getServiceType ()).isEqualTo (serviceType );
306
306
}
307
307
308
308
private static Stream <Arguments > provideServiceType () {
@@ -335,7 +335,7 @@ void getDOIAdapters_should_return_expected_list_of_DOIAdapter() {
335
335
LN0Adapter ln0Adapter = new LN0Adapter (null , ln0 );
336
336
// When Then
337
337
assertThat (ln0Adapter .getDOIAdapters ()).isNotEmpty ();
338
- assertThat (ln0Adapter .getDOIAdapters ().get ( 0 ).getCurrentElem ().getName ()).isEqualTo ("Do" );
338
+ assertThat (ln0Adapter .getDOIAdapters ().getFirst ( ).getCurrentElem ().getName ()).isEqualTo ("Do" );
339
339
}
340
340
341
341
@ Test
@@ -434,7 +434,7 @@ void testFindMatch() {
434
434
// When Then
435
435
AbstractDAIAdapter <?> daiAdapter = (AbstractDAIAdapter <?>) assertDoesNotThrow (() -> ln0Adapter .findMatch (doTypeName , daTypeName ).get ());
436
436
assertThat (daiAdapter .getCurrentElem ().getName ()).isEqualTo ("bda3" );
437
- assertThat (daiAdapter .getCurrentElem ().getVal ().get ( 0 ).getValue ()).isEqualTo ("Completed-diff" );
437
+ assertThat (daiAdapter .getCurrentElem ().getVal ().getFirst ( ).getValue ()).isEqualTo ("Completed-diff" );
438
438
DoTypeName doTypeName2 = new DoTypeName ("Do.sdo1" );
439
439
// When Then
440
440
assertThat (ln0Adapter .findMatch (doTypeName2 , daTypeName )).isEmpty ();
@@ -540,7 +540,7 @@ void testGetDAI() {
540
540
var dataAttributeRefs = ln0Adapter .getDAI (filter , false );
541
541
// Then
542
542
assertThat (dataAttributeRefs ).hasSize (1 );
543
- assertThat (dataAttributeRefs .get ( 0 ).getDaName ().getType ()).isEqualTo ("BehaviourModeKind" );
543
+ assertThat (dataAttributeRefs .getFirst ( ).getDaName ().getType ()).isEqualTo ("BehaviourModeKind" );
544
544
}
545
545
546
546
@ Test
@@ -864,7 +864,7 @@ void createControlBlockIfNotExists_should_create_SampledValueControl() {
864
864
// Then
865
865
assertThat (sourceLn0 .getCurrentElem ().getSampledValueControl ())
866
866
.hasSize (1 );
867
- TSampledValueControl tSampledValueControl = sourceLn0 .getCurrentElem ().getSampledValueControl ().get ( 0 );
867
+ TSampledValueControl tSampledValueControl = sourceLn0 .getCurrentElem ().getSampledValueControl ().getFirst ( );
868
868
assertThat (tSampledValueControl )
869
869
.extracting (TControl ::getName , TSampledValueControl ::getSmvID , TControl ::getDatSet ,
870
870
TSampledValueControl ::isMulticast , TSampledValueControl ::getSmpRate , TSampledValueControl ::getNofASDU , TSampledValueControl ::getSmpMod , TSampledValueControl ::getSecurityEnable ,
@@ -895,7 +895,7 @@ void createControlBlockIfNotExists_should_create_ReportControl() {
895
895
// Then
896
896
assertThat (sourceLn0 .getCurrentElem ().getReportControl ())
897
897
.hasSize (1 );
898
- TReportControl tReportControl = sourceLn0 .getCurrentElem ().getReportControl ().get ( 0 );
898
+ TReportControl tReportControl = sourceLn0 .getCurrentElem ().getReportControl ().getFirst ( );
899
899
assertThat (tReportControl )
900
900
.extracting (TControl ::getName , TReportControl ::getRptID , TControl ::getDatSet ,
901
901
TReportControl ::isBuffered , TReportControl ::getBufTime , TReportControl ::isIndexed , TControlWithTriggerOpt ::getIntgPd , TReportControl ::getConfRev )
@@ -1140,6 +1140,42 @@ void updateDoInRef_when_ExtRef_desc_matches_should_update_setSrcRef_and_setSrcCB
1140
1140
assertThat (sclReportItems ).isEmpty ();
1141
1141
}
1142
1142
1143
+ @ Test
1144
+ void updateDoInRef_when_DAI_purpose_of_Ldevice_LDEPF_ends_with_BOOLEAN_should_match_desc_that_ends_with_enum_and_update_setSrcRef_and_setSrcCB_and_setTstRef_and_setTstCB () {
1145
+ // Given
1146
+ SCL scd = SclTestMarshaller .getSCLFromFile ("/scd-test-update-inref/scd_update_inref_test.xml" );
1147
+ LN0Adapter sourceLn0 = findLn0 (scd , "IED_NAME1" , "LDEPF" );
1148
+ String doiNameInRef = "InRef3" ;
1149
+ String originalSetSrcCB = getDaiValue (sourceLn0 , doiNameInRef , SETSRCCB_DA_NAME );
1150
+ String expectedSrcRef = "IED_NAME1LDEPF/PRANCR1.Do11.sdo11" ;
1151
+ String expectedSrcCb = "IED_NAME1LDEPF/prefixANCR1.GSE1" ;
1152
+ String originalSetTstCB = getDaiValue (sourceLn0 , doiNameInRef , SETTSTCB_DA_NAME );
1153
+ String expectedTstRef = "IED_NAME1LDEPF/PRANCR1.Do11.sdo11" ;
1154
+ String expectedTstCB = "IED_NAME1LDEPF/prefixANCR3.GSE3" ;
1155
+
1156
+ // When
1157
+ List <SclReportItem > sclReportItems = sourceLn0 .updateDoInRef ();
1158
+ // Then
1159
+
1160
+ String finalSetSrcRef = getDaiValue (sourceLn0 , doiNameInRef , SETSRCREF_DA_NAME );
1161
+ String finalSetSrcCB = getDaiValue (sourceLn0 , doiNameInRef , SETSRCCB_DA_NAME );
1162
+ String finalSetTstRef = getDaiValue (sourceLn0 , doiNameInRef , SETTSTREF_DA_NAME );
1163
+ String finalSetTstCB = getDaiValue (sourceLn0 , doiNameInRef , SETTSTCB_DA_NAME );
1164
+ assertThat (finalSetSrcRef )
1165
+ .isNotBlank ()
1166
+ .isEqualTo (expectedSrcRef );
1167
+ assertThat (finalSetSrcCB )
1168
+ .isNotEqualTo (originalSetSrcCB )
1169
+ .isEqualTo (expectedSrcCb );
1170
+ assertThat (finalSetTstRef )
1171
+ .isNotBlank ()
1172
+ .isEqualTo (expectedTstRef );
1173
+ assertThat (finalSetTstCB )
1174
+ .isNotEqualTo (originalSetTstCB )
1175
+ .isEqualTo (expectedTstCB );
1176
+ assertThat (sclReportItems ).isEmpty ();
1177
+ }
1178
+
1143
1179
@ Test
1144
1180
void updateDoInRef_when_ExtRef_desc_matches_and_dais_not_updatable_should_not_update_setSrcRef_and_setSrcCB_and_setTstRef_and_setTstCB () {
1145
1181
// Given
0 commit comments