1313import  hlf .java .rest .client .model .ChannelUpdateParamsDTO ;
1414import  hlf .java .rest .client .model .ClientResponseModel ;
1515import  hlf .java .rest .client .model .CommitChannelParamsDTO ;
16+ import  hlf .java .rest .client .model .MSPDTO ;
1617import  hlf .java .rest .client .service .ChannelConfigDeserialization ;
1718import  java .util .ArrayList ;
1819import  java .util .Collections ;
@@ -72,6 +73,7 @@ public class NetworkStatusImplTest {
7273  @ Mock  private  ConfigGroup  readset ;
7374
7475  @ Mock  private  ConfigGroup  writeset ;
76+   @ Mock  private  MSPDTO  mspdto ;
7577
7678  @ Mock  private  Builder  builder ;
7779
@@ -106,26 +108,15 @@ public void getChannelFromNetworkTest()
106108  }
107109
108110  @ Test 
109-   public  void  generateConfigUpdateTest ()
110-       throws  InvalidProtocolBufferException , InvalidArgumentException , TransactionException  {
111+   public  void  generateConfigUpdateTest () throws  InvalidProtocolBufferException  {
111112    ResponseEntity <ClientResponseModel > responseEntity  =
112113        new  ResponseEntity <>(
113114            new  ClientResponseModel (ErrorConstants .NO_ERROR , "dGhlX2NvbmZpZw==" ), HttpStatus .OK );
114115    Mockito .when (gateway .getNetwork (Mockito .anyString ())).thenReturn (network );
115-     Mockito .when (network .getChannel ()).thenReturn (channel );
116- 
117-     Mockito .when (channel .getChannelConfigurationBytes ()).thenReturn (new  byte [0 ]);
118116    staticConfigUpdate 
119117        .when (() -> ConfigUpdate .parseFrom (Mockito .any (byte [].class )))
120118        .thenReturn (configUpdate );
121119    staticConfigUpdate .when (() -> ConfigUpdate .newBuilder ()).thenReturn (builder );
122-     Mockito .when (configUpdate .getReadSet ()).thenReturn (readset );
123-     Mockito .when (builder .setChannelId (Mockito .anyString ())).thenReturn (builder );
124-     Mockito .when (builder .setReadSet (Mockito .any (ConfigGroup .class ))).thenReturn (builder );
125-     Mockito .when (
126-             updateChannel .buildWriteset (Mockito .any (), Mockito .any (ChannelUpdateParamsDTO .class )))
127-         .thenReturn (readset );
128-     Mockito .when (builder .setWriteSet (Mockito .any (ConfigGroup .class ))).thenReturn (builder );
129120    Mockito .when (builder .build ()).thenReturn (configUpdate );
130121    staticJsonFormat .when (JsonFormat ::printer ).thenReturn (printer );
131122    Mockito .when (printer .print (Mockito .any (MessageOrBuilder .class ))).thenReturn ("the_config" );
@@ -201,7 +192,6 @@ public void addOrgToChannelTest() throws InvalidArgumentException, TransactionEx
201192
202193    Mockito .when (gateway .getNetwork (Mockito .anyString ())).thenReturn (network );
203194    Mockito .when (network .getChannel ()).thenReturn (channel );
204- 
205195    Mockito .when (channel .getChannelConfigurationBytes ()).thenReturn (new  byte [0 ]);
206196    staticConfigUpdate 
207197        .when (() -> ConfigUpdate .parseFrom (Mockito .any (byte [].class )))
@@ -224,10 +214,12 @@ public void addOrgToChannelTest() throws InvalidArgumentException, TransactionEx
224214                Mockito .any (UpdateChannelConfiguration .class ), Mockito .any (User .class )))
225215        .thenReturn (outputByteArray );
226216
217+     Mockito .when (channelUpdateParamsDTO .getMspDTO ()).thenReturn (mspdto );
218+ 
227219    assertEquals (
228220        responseEntity .getBody ().getMessage (),
229221        networkStatus 
230-             .addOrgToChannel ("some_channel_name" , new   ChannelUpdateParamsDTO () )
222+             .addOrgToChannel ("some_channel_name" , channelUpdateParamsDTO )
231223            .getBody ()
232224            .getMessage ());
233225  }
0 commit comments