### Question:
Keys { public static String getAddress(ECKeyPair ecKeyPair) { return getAddress(ecKeyPair.getPublicKey()); } private  Keys(); static ECKeyPair createEcKeyPair(); static String getAddress(ECKeyPair ecKeyPair); static String getAddress(BigInteger publicKey); static String getAddress(String publicKey); static byte[] getAddress(byte[] publicKey); static byte[] serialize(ECKeyPair ecKeyPair); static ECKeyPair deserialize(byte[] input); static boolean verifyAddress(String address); static boolean verifyPrivateKey(String privateKey); static final int ADDRESS_SIZE; static final int ADDRESS_LENGTH_IN_HEX; static final int PRIVATE_KEY_LENGTH_IN_HEX; }### Answer:
@Test public void testGetAddressString() { assertThat(Keys.getAddress(SampleKeys.PUBLIC_KEY_STRING), is(SampleKeys.ADDRESS_NO_PREFIX)); }
@Test public void testGetAddressZeroPaddedAddress() { String publicKey = "0xa1b31be4d58a7ddd24b135db0da56a90fb5382077ae26b250e1dc9cd6232ce22" + "70f4c995428bc76aa78e522316e95d7834d725efc9ca754d043233af6ca90113"; assertThat(Keys.getAddress(publicKey), is("01c52b08330e05d731e38c856c1043288f7d9744")); }
@Test public void testGetAddressBigInteger() { assertThat(Keys.getAddress(SampleKeys.PUBLIC_KEY), is(SampleKeys.ADDRESS_NO_PREFIX)); }
@Test public void testGetAddressSmallPublicKey() { byte[] address = Keys.getAddress( Numeric.toBytesPadded(BigInteger.valueOf(0x1234), Keys.PUBLIC_KEY_SIZE)); String expected = Numeric.toHexStringNoPrefix(address); assertThat(Keys.getAddress("0x1234"), equalTo(expected)); }
@Test public void testGetAddressZeroPadded() { byte[] address = Keys.getAddress( Numeric.toBytesPadded(BigInteger.valueOf(0x1234), Keys.PUBLIC_KEY_SIZE)); String expected = Numeric.toHexStringNoPrefix(address); String value = "1234"; assertThat(Keys.getAddress("0x" + Strings.zeros(Keys.PUBLIC_KEY_LENGTH_IN_HEX - value.length()) + value), equalTo(expected)); }