AccountAddress implements Serializable { public static AccountAddress fromHexString(String publicKeyHexString) { logger.traceEntry("params: {}", publicKeyHexString); Util.check(publicKeyHexString != null, "publicKeyHexString!=null"); Util.check(!publicKeyHexString.isEmpty(), "publicKeyHexString!=null"); return logger.traceExit(new AccountAddress(Util.hexStringToByteArray(publicKeyHexString))); } private  AccountAddress(byte[] publicKeyBytes); byte[] getBytes(); static AccountAddress fromHexString(String publicKeyHexString); static AccountAddress fromBytes(byte[] publicKeyBytes); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final AccountAddress EMPTY_ADDRESS; }
@Test public void testAccountAddressFromHexaString() { PublicKey publicKeyMinting = AppServiceProvider.getShardingService().getPublicKeyForMinting(new Shard(0)); AccountAddress accountAddress = AccountAddress.fromHexString(Util.byteArrayToHexString(publicKeyMinting.getValue())); Assert.assertTrue(accountAddress != null); }
@Test(expected = IllegalArgumentException.class) public void testAccountAddressFromNullHexaStringShouldThrowException() { AccountAddress.fromHexString(null); Assert.fail(); }