66
77import org .assertj .core .api .Assertions ;
88import org .assertj .core .groups .Tuple ;
9+ import org .junit .jupiter .api .Tag ;
910import org .junit .jupiter .api .Test ;
1011import org .junit .jupiter .api .extension .ExtendWith ;
1112import org .junit .jupiter .params .ParameterizedTest ;
3839import java .util .Optional ;
3940import java .util .stream .Stream ;
4041
41- import static org .assertj .core .api .Assertions .assertThat ;
42- import static org .assertj .core .api .Assertions .assertThatThrownBy ;
42+ import static org .assertj .core .api .Assertions .*;
4343import static org .junit .jupiter .api .Assertions .assertDoesNotThrow ;
4444import static org .lfenergy .compas .scl2007b4 .model .TFCEnum .ST ;
4545import static org .lfenergy .compas .sct .commons .dto .ControlBlockNetworkSettings .*;
@@ -559,7 +559,7 @@ void filterDuplicatedExtRefs_should_not_remove_not_duplicated_extrefs() {
559559 }
560560
561561 @ Test
562- void manageBindingForLDEPF_should_return_noReportAndExtRefUpdateSuccessfully_whenFlowKindIsInternalAndAllExtRefInSameBay () {
562+ void manageBindingForLDEPF_whenFlowKindIsInternalAndAllExtRefInSameBay_should_return_noReportAndExtRefUpdateSuccessfully () {
563563 //Given
564564 String fileName = "LDEPF_Setting_file.csv" ;
565565 InputStream inputStream = Objects .requireNonNull (CsvUtils .class .getClassLoader ().getResourceAsStream (fileName ), "Resource not found: " + fileName );
@@ -626,7 +626,8 @@ void manageBindingForLDEPF_should_return_noReportAndExtRefUpdateSuccessfully_whe
626626 }
627627
628628 @ Test
629- void manageBindingForLDEPF_should_return_no_report_when_extRef_withDifferentIedType_update_successfully () {
629+ void manageBindingForLDEPF_when_extRef_withDifferentIedType_update_successfully_should_return_no_report () {
630+ // Given
630631 String fileName = "LDEPF_Setting_file.csv" ;
631632 InputStream inputStream = Objects .requireNonNull (CsvUtils .class .getClassLoader ().getResourceAsStream (fileName ), "Resource not found: " + fileName );
632633 InputStreamReader reader = new InputStreamReader (inputStream );
@@ -703,7 +704,7 @@ void manageBindingForLDEPF_should_return_no_report_when_extRef_withDifferentIedT
703704 }
704705
705706 @ Test
706- void manageBindingForLDEPF_should_return_report_when_manyIedSourceFound () {
707+ void manageBindingForLDEPF_when_manyIedSourceFound_should_return_report () {
707708 //Given
708709 String fileName = "LDEPF_Setting_file.csv" ;
709710 InputStream inputStream = Objects .requireNonNull (CsvUtils .class .getClassLoader ().getResourceAsStream (fileName ), "Resource not found: " + fileName );
@@ -746,7 +747,8 @@ void manageBindingForLDEPF_should_return_report_when_manyIedSourceFound() {
746747 }
747748
748749 @ Test
749- void manageBindingForLDEPF_should_return_no_report_when_extRefInFlowKindInternalAndExternal_update_successfully () {
750+ void manageBindingForLDEPF_when_extRefInFlowKindInternalAndExternal_update_successfully_should_return_no_report () {
751+ //Given
750752 String fileName = "LDEPF_Setting_file.csv" ;
751753 InputStream inputStream = Objects .requireNonNull (CsvUtils .class .getClassLoader ().getResourceAsStream (fileName ), "Resource not found: " + fileName );
752754 InputStreamReader reader = new InputStreamReader (inputStream );
@@ -815,24 +817,27 @@ private LDEPFSettingData getLDEPFSettingByAnalogNum(List<LDEPFSettingData> setti
815817 }
816818
817819 @ Test
818- void updateExtRefSource_shouldThrowScdException_whenSignalInfoNullOrInvalid () {
820+ @ Tag ("issue-321" )
821+ void updateExtRefSource_whenSignalInfoNullOrInvalid_shouldThrowScdException () {
819822 //Given
820823 SCL scd = SclTestMarshaller .getSCLFromFile ("/scl-srv-scd-extref-cb/scd_get_cbs_test.xml" );
821824 ExtRefInfo extRefInfo = new ExtRefInfo ();
822825 extRefInfo .setHolderIEDName ("IED_NAME2" );
823826 extRefInfo .setHolderLDInst ("LD_INST21" );
824827 extRefInfo .setHolderLnClass (TLLN0Enum .LLN_0 .value ());
825-
826- //When Then
827828 assertThat (extRefInfo .getSignalInfo ()).isNull ();
829+ //When Then
828830 assertThatThrownBy (() -> extRefService .updateExtRefSource (scd , extRefInfo )).isInstanceOf (ScdException .class ); // signal = null
831+ //Given
829832 extRefInfo .setSignalInfo (new ExtRefSignalInfo ());
830833 assertThat (extRefInfo .getSignalInfo ()).isNotNull ();
834+ //When Then
831835 assertThatThrownBy (() -> extRefService .updateExtRefSource (scd , extRefInfo )).isInstanceOf (ScdException .class );// signal invalid
832836 }
833837
834838 @ Test
835- void updateExtRefSource_shouldThrowScdException_whenBindingInfoNullOrInvalid () {
839+ @ Tag ("issue-321" )
840+ void updateExtRefSource_whenBindingInfoNullOrInvalid_shouldThrowScdException () {
836841 //Given
837842 SCL scd = SclTestMarshaller .getSCLFromFile ("/scl-srv-scd-extref-cb/scd_get_cbs_test.xml" );
838843 ExtRefInfo extRefInfo = new ExtRefInfo ();
@@ -845,16 +850,19 @@ void updateExtRefSource_shouldThrowScdException_whenBindingInfoNullOrInvalid() {
845850 extRefSignalInfo .setPDA ("da21.bda211.bda212.bda213" );
846851 extRefSignalInfo .setPDO ("Do21.sdo21" );
847852 extRefInfo .setSignalInfo (extRefSignalInfo );
848- //When Then
849853 assertThat (extRefInfo .getBindingInfo ()).isNull ();
850- assertThatThrownBy (() -> extRefService .updateExtRefSource (scd , extRefInfo )).isInstanceOf (ScdException .class ); // binding = null
854+ //When Then
855+ assertThatThrownBy (() -> extRefService .updateExtRefSource (scd , extRefInfo ))
856+ .isInstanceOf (ScdException .class ); // binding = null
857+ //Given
851858 extRefInfo .setBindingInfo (new ExtRefBindingInfo ());
852859 assertThat (extRefInfo .getBindingInfo ()).isNotNull ();
860+ //When Then
853861 assertThatThrownBy (() -> extRefService .updateExtRefSource (scd , extRefInfo )).isInstanceOf (ScdException .class );// binding invalid
854862 }
855863
856864 @ Test
857- void updateExtRefSource_shouldThrowScdException_whenBindingInternalByIedName () {
865+ void updateExtRefSource_whenBindingInternalByIedName_shouldThrowScdException () {
858866 //Given
859867 SCL scd = SclTestMarshaller .getSCLFromFile ("/scl-srv-scd-extref-cb/scd_get_cbs_test.xml" );
860868 ExtRefInfo extRefInfo = new ExtRefInfo ();
@@ -878,7 +886,7 @@ void updateExtRefSource_shouldThrowScdException_whenBindingInternalByIedName() {
878886 }
879887
880888 @ Test
881- void updateExtRefSource_shouldThrowScdException_whenBindingInternaByServiceType () {
889+ void updateExtRefSource_whenBindingInternaByServiceType_shouldThrowScdException () {
882890 //Given
883891 SCL scd = SclTestMarshaller .getSCLFromFile ("/scl-srv-scd-extref-cb/scd_get_cbs_test.xml" );
884892 ExtRefInfo extRefInfo = new ExtRefInfo ();
@@ -903,7 +911,8 @@ void updateExtRefSource_shouldThrowScdException_whenBindingInternaByServiceType(
903911 }
904912
905913 @ Test
906- void updateExtRefSource_shouldThrowScdException_whenSourceInfoNullOrInvalid () {
914+ @ Tag ("issue-321" )
915+ void updateExtRefSource_whenSourceInfoNullOrInvalid_shouldThrowScdException () {
907916 //Given
908917 SCL scd = SclTestMarshaller .getSCLFromFile ("/scl-srv-scd-extref-cb/scd_get_cbs_test.xml" );
909918 ExtRefInfo extRefInfo = new ExtRefInfo ();
@@ -923,16 +932,18 @@ void updateExtRefSource_shouldThrowScdException_whenSourceInfoNullOrInvalid() {
923932 extRefBindingInfo .setLnClass (TLLN0Enum .LLN_0 .value ());
924933 extRefInfo .setBindingInfo (new ExtRefBindingInfo ());
925934
926- //When Then
927935 assertThat (extRefInfo .getSourceInfo ()).isNull ();
936+ //When Then
928937 assertThatThrownBy (() -> extRefService .updateExtRefSource (scd , extRefInfo )).isInstanceOf (ScdException .class ); // signal = null
938+ //Given
929939 extRefInfo .setSourceInfo (new ExtRefSourceInfo ());
930940 assertThat (extRefInfo .getSourceInfo ()).isNotNull ();
941+ //When Then
931942 assertThatThrownBy (() -> extRefService .updateExtRefSource (scd , extRefInfo )).isInstanceOf (ScdException .class );// signal invalid
932943 }
933944
934945 @ Test
935- void updateExtRefSource_shouldThrowScdException_whenBindingExternalBinding () {
946+ void updateExtRefSource_whenBindingExternalBinding_shouldThrowScdException () {
936947 //Given
937948 SCL scd = SclTestMarshaller .getSCLFromFile ("/scl-srv-scd-extref-cb/scd_get_cbs_test.xml" );
938949 ExtRefInfo extRefInfo = new ExtRefInfo ();
0 commit comments