1414 */
1515package org .fisco .bcos .sdk .v3 .test .transaction .manager ;
1616
17- import com .google .common .collect .Lists ;
18-
1917import java .math .BigInteger ;
20- import java .util .ArrayList ;
21- import java .util .Arrays ;
22- import java .util .Base64 ;
23- import java .util .List ;
24- import java .util .Map ;
25- import java .util .Objects ;
18+ import java .util .*;
2619import java .util .concurrent .CompletableFuture ;
2720
2821import org .apache .commons .collections4 .ListUtils ;
@@ -174,7 +167,7 @@ public void test11HelloWorldAsync() throws Exception {
174167 // send tx with callback
175168 String to = callbackMock .getResult ().getContractAddress ();
176169 System .out .println ("contract address is " + to );
177- List <Object > params = Lists . newArrayList ("test" );
170+ List <Object > params = Collections . singletonList ("test" );
178171 transactionProcessor .sendTransactionAsync (to , abi , "set" , params , callbackMock );
179172 Assert .assertEquals (0 , callbackMock .getResult ().getStatus ());
180173
@@ -205,7 +198,7 @@ public void test2ComplexDeploy() throws Exception {
205198 TransactionProcessorFactory .createAssembleTransactionProcessor (
206199 this .client , this .cryptoKeyPair , ABI_FILE , BIN_FILE );
207200 // deploy
208- List <Object > params = Lists . newArrayList ();
201+ List <Object > params = new ArrayList <> ();
209202 params .add (1 );
210203 params .add ("test2" );
211204 TransactionResponse response =
@@ -233,7 +226,7 @@ public void test3ComplexQuery() throws Exception {
233226 TransactionProcessorFactory .createAssembleTransactionProcessor (
234227 this .client , this .cryptoKeyPair , ABI_FILE , BIN_FILE );
235228 // deploy
236- List <Object > params = Lists . newArrayList ();
229+ List <Object > params = new ArrayList <> ();
237230 params .add (1 );
238231 params .add ("test2" );
239232 TransactionResponse response =
@@ -273,7 +266,7 @@ public void test4ComplexEmptyTx() throws Exception {
273266 TransactionProcessorFactory .createAssembleTransactionProcessor (
274267 this .client , this .cryptoKeyPair , ABI_FILE , BIN_FILE );
275268 // deploy
276- List <Object > params = Lists . newArrayList ();
269+ List <Object > params = new ArrayList <> ();
277270 params .add (1 );
278271 params .add ("test2" );
279272 TransactionResponse response =
@@ -293,7 +286,7 @@ public void test5ComplexIncrement() throws Exception {
293286 TransactionProcessorFactory .createAssembleTransactionProcessor (
294287 this .client , this .cryptoKeyPair , ABI_FILE , BIN_FILE );
295288 // deploy
296- List <Object > params = Lists . newArrayList ();
289+ List <Object > params = new ArrayList <> ();
297290 params .add (1 );
298291 params .add ("test2" );
299292 TransactionResponse response =
@@ -305,7 +298,7 @@ public void test5ComplexIncrement() throws Exception {
305298 contractAddress ,
306299 this .ABI ,
307300 "incrementUint256" ,
308- Lists . newArrayList (BigInteger .valueOf (10 )),
301+ Collections . singletonList (BigInteger .valueOf (10 )),
309302 new TransactionCallback () {
310303 @ Override
311304 public void onResponse (TransactionReceipt receipt ) {
@@ -320,7 +313,7 @@ public void onResponse(TransactionReceipt receipt) {
320313 contractAddress ,
321314 AssembleTransactionProcessorTest .this .ABI ,
322315 "getUint256" ,
323- Lists . newArrayList ());
316+ new ArrayList <> ());
324317 System .out .println (JsonUtils .toJson (callResponse3 ));
325318 Assert .assertEquals ("Success" , callResponse3 .getReturnMessage ());
326319 } catch (TransactionBaseException | ContractCodecException e ) {
@@ -336,15 +329,15 @@ public void test6ComplexSetValues() throws Exception {
336329 TransactionProcessorFactory .createAssembleTransactionProcessor (
337330 this .client , this .cryptoKeyPair , ABI_FILE , BIN_FILE );
338331 // deploy
339- List <Object > params = Lists . newArrayList ();
332+ List <Object > params = new ArrayList <> ();
340333 params .add (-1 );
341334 params .add ("test2" );
342335 TransactionResponse response =
343336 transactionProcessor .deployByContractLoader ("ComplexSol" , params );
344337 Assert .assertEquals (response .getTransactionReceipt ().getStatus (), 0 );
345338 String contractAddress = response .getContractAddress ();
346339 // set values
347- List <Object > paramsSetValues = Lists . newArrayList (-20 );
340+ List <Object > paramsSetValues = new ArrayList <>( Collections . singletonList (-20 ) );
348341 String [] o = {"0x1" , "0x2" , "0x3" };
349342 List <String > a = Arrays .asList (o );
350343 paramsSetValues .add (a );
@@ -363,7 +356,7 @@ public void test6ComplexSetValues() throws Exception {
363356 contractAddress ,
364357 ABI ,
365358 "getValues" ,
366- Lists . newArrayList ());
359+ new ArrayList <> ());
367360 Assert .assertEquals (0 , callResponse4 .getReturnCode ());
368361 Assert .assertEquals (
369362 callResponse4 .getResults ().get (0 ).getValue (), new Int256 (-20 ).getValue ());
@@ -376,7 +369,7 @@ public void test7ComplexSetBytes() throws Exception {
376369 TransactionProcessorFactory .createAssembleTransactionProcessor (
377370 this .client , this .cryptoKeyPair , ABI_FILE , BIN_FILE );
378371 // deploy
379- List <Object > params = Lists . newArrayList ();
372+ List <Object > params = new ArrayList <> ();
380373 params .add (1 );
381374 params .add ("test2" );
382375 TransactionResponse response =
@@ -385,7 +378,7 @@ public void test7ComplexSetBytes() throws Exception {
385378 String contractAddress = response .getContractAddress ();
386379 // setBytes
387380 {
388- List <String > paramsSetBytes = Lists . newArrayList (new String ("123" .getBytes ()));
381+ List <String > paramsSetBytes = Collections . singletonList (new String ("123" .getBytes ()));
389382 TransactionResponse transactionResponse3 =
390383 transactionProcessor .sendTransactionWithStringParamsAndGetResponse (
391384 contractAddress , ABI , "setBytes" , paramsSetBytes );
@@ -402,7 +395,7 @@ public void test7ComplexSetBytes() throws Exception {
402395 contractAddress ,
403396 ABI ,
404397 "_bytesV" ,
405- Lists . newArrayList ());
398+ new ArrayList <> ());
406399 Assert .assertEquals (0 , callResponse4 .getReturnCode ());
407400 Assert .assertEquals (
408401 Hex .toHexString ((byte []) callResponse4 .getResults ().get (0 ).getValue ()),
@@ -412,7 +405,7 @@ public void test7ComplexSetBytes() throws Exception {
412405 // setBytes
413406 {
414407 List <String > paramsSetBytes2 =
415- Lists . newArrayList (new String ("hex://0x1234" .getBytes ()));
408+ Collections . singletonList (new String ("hex://0x1234" .getBytes ()));
416409 TransactionResponse transactionResponse4 =
417410 transactionProcessor .sendTransactionWithStringParamsAndGetResponse (
418411 contractAddress , ABI , "setBytes" , paramsSetBytes2 );
@@ -428,7 +421,7 @@ public void test7ComplexSetBytes() throws Exception {
428421 contractAddress ,
429422 ABI ,
430423 "_bytesV" ,
431- Lists . newArrayList ());
424+ new ArrayList <> ());
432425 Assert .assertEquals (0 , callResponse4 .getReturnCode ());
433426 }
434427 }
@@ -439,24 +432,22 @@ public void test8ComplexSetBytesFuture() throws Exception {
439432 TransactionProcessorFactory .createAssembleTransactionProcessor (
440433 this .client , this .cryptoKeyPair , ABI_FILE , BIN_FILE );
441434 // deploy
442- List <Object > params = Lists . newArrayList ();
435+ List <Object > params = new ArrayList <> ();
443436 params .add (1 );
444437 params .add ("test2" );
445438 TransactionResponse response =
446439 transactionProcessor .deployByContractLoader ("ComplexSol" , params );
447440 Assert .assertEquals (response .getTransactionReceipt ().getStatus (), 0 );
448441 String contractAddress = response .getContractAddress ();
449- List <Object > paramsSetBytes = Lists . newArrayList ("2" .getBytes ());
442+ List <Object > paramsSetBytes = Collections . singletonList ("2" .getBytes ());
450443 byte [] data = transactionProcessor .encodeFunction (ABI , "setBytes" , paramsSetBytes );
451444 TxPair txPair =
452445 transactionProcessor .createSignedTransaction (
453446 contractAddress , data , this .cryptoKeyPair , 0 );
454447 CompletableFuture <TransactionReceipt > future =
455448 transactionProcessor .sendTransactionAsync (txPair .getSignedTx ());
456449 future .thenAccept (
457- r -> {
458- Assert .assertEquals (0 , response .getTransactionReceipt ().getStatus ());
459- });
450+ r -> Assert .assertEquals (0 , response .getTransactionReceipt ().getStatus ()));
460451
461452 TxPair txPair0 =
462453 transactionProcessor .createSignedTransaction (
@@ -475,7 +466,7 @@ public void test9ComplexSetStaticBytes() throws Exception {
475466 TransactionProcessorFactory .createAssembleTransactionProcessor (
476467 this .client , this .cryptoKeyPair , ABI_FILE , BIN_FILE );
477468 // deploy
478- List <Object > params = Lists . newArrayList ();
469+ List <Object > params = new ArrayList <> ();
479470 params .add (1 );
480471 params .add ("test2" );
481472 TransactionResponse response =
@@ -485,7 +476,7 @@ public void test9ComplexSetStaticBytes() throws Exception {
485476
486477 // setStaticByte4 in hex
487478 {
488- List <String > paramsSetBytes = Lists . newArrayList ("hex://0x12345678" );
479+ List <String > paramsSetBytes = Collections . singletonList ("hex://0x12345678" );
489480 TransactionResponse transactionResponse3 =
490481 transactionProcessor .sendTransactionWithStringParamsAndGetResponse (
491482 contractAddress , ABI , "setStaticByte4" , paramsSetBytes );
@@ -498,7 +489,7 @@ public void test9ComplexSetStaticBytes() throws Exception {
498489 contractAddress ,
499490 ABI ,
500491 "_bytes4V" ,
501- Lists . newArrayList ());
492+ new ArrayList <> ());
502493 Assert .assertEquals (0 , callResponse4 .getReturnCode ());
503494 Assert .assertEquals (
504495 Hex .toHexString ((byte []) callResponse4 .getResults ().get (0 ).getValue ()),
@@ -514,7 +505,7 @@ public void test10EventDemo() throws Exception {
514505 String contractAddress = null ;
515506 // deploy
516507 {
517- List <Object > params = Lists . newArrayList ();
508+ List <Object > params = new ArrayList <> ();
518509 TransactionResponse response =
519510 transactionProcessor .deployByContractLoader ("EventSubDemo" , params );
520511 Assert .assertEquals (response .getTransactionReceipt ().getStatus (), 0 );
@@ -561,13 +552,13 @@ public void test11CallWithSign() throws Exception {
561552 TransactionProcessorFactory .createAssembleTransactionProcessor (
562553 this .client , this .cryptoKeyPair , ABI_FILE , BIN_FILE );
563554
564- if (client .getChainCompatibilityVersion ().compareTo (EnumNodeVersion .BCOS_3_4_0 .toVersionObj ()) < 0 ){
555+ if (client .getChainCompatibilityVersion ().compareTo (EnumNodeVersion .BCOS_3_4_0 .toVersionObj ()) < 0 ) {
565556 return ;
566557 }
567558 String contractAddress = null ;
568559 // deploy
569560 {
570- List <Object > params = Lists . newArrayList ();
561+ List <Object > params = new ArrayList <> ();
571562 TransactionResponse response =
572563 transactionProcessor .deployByContractLoader ("TestCallWithSign" , params );
573564 Assert .assertEquals (response .getTransactionReceipt ().getStatus (), 0 );
0 commit comments