@@ -99,59 +99,46 @@ public void beforeClass() {
9999 @ Test
100100 public void testCreateAccount () {
101101 Account noCreateAccount = queryAccount (lowBalTest , blockingStubFull );
102- if (noCreateAccount .getAccountName ().isEmpty ()) {
103- Assert .assertTrue (PublicMethed .freezeBalance (fromAddress , 10000000 , 3 , testKey002 ,
104- blockingStubFull ));
105- Assert .assertTrue (sendCoin (lowBalAddress , 1L , fromAddress , testKey002 ));
106- //Assert.assertTrue(Sendcoin(Low_Bal_ADDRESS, 1000000L, fromAddress, testKey002));
102+ while (noCreateAccount .getBalance () != 0 ) {
103+ ecKey = new ECKey (Utils .getRandom ());
104+ lowBalAddress = ecKey .getAddress ();
105+ lowBalTest = ByteArray .toHexString (ecKey .getPrivKeyBytes ());
107106 noCreateAccount = queryAccount (lowBalTest , blockingStubFull );
108- logger .info (Long .toString (noCreateAccount .getBalance ()));
109- Assert .assertTrue (noCreateAccount .getBalance () == 1 );
110-
111- //TestVoteToNonWitnessAccount
112- HashMap <String , String > voteToNonWitnessAccount = new HashMap <String , String >();
113- voteToNonWitnessAccount .put ("27dUQbeRLz6BavhUJE6UbNp5AtAtPuzNZv6" , "3" );
114- HashMap <String , String > voteToInvaildAddress = new HashMap <String , String >();
115- voteToInvaildAddress .put ("27cu1ozb4mX3m2afY68FSAqn3HmMp815d48" , "4" );
116- Assert .assertTrue (freezeBalance (fromAddress , 10000000L , 3L , testKey002 ));
117- voteWitness (voteToNonWitnessAccount , fromAddress , testKey002 );
118- Assert .assertFalse (voteWitness (voteToNonWitnessAccount , fromAddress , testKey002 ));
119- Assert .assertFalse (voteWitness (voteToInvaildAddress , fromAddress , testKey002 ));
107+ }
120108
121- logger .info ("vote to non witness account ok!!!" );
109+ Assert .assertTrue (sendCoin (lowBalAddress , 1L , fromAddress , testKey002 ));
110+ noCreateAccount = queryAccount (lowBalTest , blockingStubFull );
111+ logger .info (Long .toString (noCreateAccount .getBalance ()));
112+ Assert .assertTrue (noCreateAccount .getBalance () == 1 );
113+
114+ //TestVoteToNonWitnessAccount
115+ HashMap <String , String > voteToNonWitnessAccount = new HashMap <String , String >();
116+ voteToNonWitnessAccount .put ("27dUQbeRLz6BavhUJE6UbNp5AtAtPuzNZv6" , "3" );
117+ HashMap <String , String > voteToInvaildAddress = new HashMap <String , String >();
118+ voteToInvaildAddress .put ("27cu1ozb4mX3m2afY68FSAqn3HmMp815d48" , "4" );
119+ Assert .assertTrue (freezeBalance (fromAddress , 10000000L , 3L , testKey002 ));
120+ voteWitness (voteToNonWitnessAccount , fromAddress , testKey002 );
121+ Assert .assertFalse (voteWitness (voteToNonWitnessAccount , fromAddress , testKey002 ));
122+ Assert .assertFalse (voteWitness (voteToInvaildAddress , fromAddress , testKey002 ));
122123
123- } else {
124- logger .info (
125- "Please confirm wither the create account test is pass, or you will do it by manual" );
126- }
127124 }
128125
129126 @ Test (enabled = true )
130127 public void testUpdateAccount () {
128+ Assert .assertFalse (updateAccount (lowBalAddress ,
129+ mostLongNamePlusOneChar .getBytes (), lowBalTest ));
130+ Assert .assertTrue (updateAccount (lowBalAddress , "" .getBytes (), lowBalTest ));
131+ Assert .assertTrue (updateAccount (lowBalAddress , mostLongName .getBytes (), lowBalTest ));
131132 Account tryToUpdateAccount = queryAccount (lowBalTest , blockingStubFull );
132- if (tryToUpdateAccount .getAccountName ().isEmpty ()) {
133- //Assert.assertFalse(updateAccount(lowBalAddress, "".getBytes(), lowBalTest));
134- Assert .assertFalse (
135- updateAccount (lowBalAddress , mostLongNamePlusOneChar .getBytes (),
136- lowBalTest ));
137-
138- Assert .assertTrue (updateAccount (lowBalAddress , "" .getBytes (), lowBalTest ));
139- Assert .assertTrue (updateAccount (lowBalAddress , mostLongName .getBytes (), lowBalTest ));
140- tryToUpdateAccount = queryAccount (lowBalTest , blockingStubFull );
141- Assert .assertFalse (tryToUpdateAccount .getAccountName ().isEmpty ());
142- Assert .assertTrue (updateAccount (lowBalAddress , "secondUpdateName" .getBytes (), lowBalTest ));
143- }
133+ tryToUpdateAccount = queryAccount (lowBalTest , blockingStubFull );
134+ Assert .assertFalse (tryToUpdateAccount .getAccountName ().isEmpty ());
135+ Assert .assertTrue (updateAccount (lowBalAddress , "secondUpdateName" .getBytes (), lowBalTest ));
144136 }
145137
146138 @ Test (enabled = true )
147139 public void testNoBalanceCreateAssetIssue () {
148140 Account lowaccount = queryAccount (lowBalTest , blockingStubFull );
149141 if (lowaccount .getBalance () > 0 ) {
150- /* try {
151- Thread.sleep(10000);
152- } catch (InterruptedException e) {
153- e.printStackTrace();
154- }*/
155142 Assert .assertTrue (sendCoin (toAddress , lowaccount .getBalance (), lowBalAddress , lowBalTest ));
156143 }
157144 //Create AssetIssue failed when there is no enough balance.
0 commit comments