modify getBlockTest
@@ -3,6 +3,7 @@ package org.fisco.bcos.channel.test.block;
import org.fisco.bcos.channel.test.TestBase;
import org.fisco.bcos.web3j.protocol.core.DefaultBlockParameter;
import org.fisco.bcos.web3j.protocol.core.methods.response.BcosBlock;
+import org.fisco.bcos.web3j.utils.Numeric;
import org.junit.Test;
import java.io.IOException;
@@ -15,10 +16,8 @@ public class BlockTest extends TestBase {
@Test
public void getBlockNumber() throws IOException {
- BcosBlock.Block block= web3j.getBlockByNumber(DefaultBlockParameter.valueOf(new BigInteger("1")), true).send().getBlock();
- assertEquals( block.getNonce(),new BigInteger("0"));
- System.out.println("getBlockNumber " + block.getNumber());
- System.out.println("***** current block number is ***** " + (web3j.getBlockNumberCache().intValue()-500));
- assertTrue( block.getNumber().intValue()>0);
+ final String blockNumber = web3j.getBlockNumber().sendForReturnString();
+ System.out.println(blockNumber);
+ assertTrue(Numeric.decodeQuantity(blockNumber).compareTo(new BigInteger("0")) >= 0);
}
}
