PublicKey implements ByteSerializable, Serializable { @Override public boolean equals(Object obj) { PublicKey other = (PublicKey) obj; return this.publicKey.equals(other.getKey()); } PublicKey(ECKey key); ECKey getKey(); @Override byte[] toBytes(); String getAddress(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void equals() throws Exception { Address address1 = new Address("BTS8RiFgs8HkcVPVobHLKEv6yL3iXcC9SWjbPVS15dDAXLG9GYhnY"); Address address2 = new Address("BTS8RiFgs8HkcVPVobHLKEv6yL3iXcC9SWjbPVS15dDAXLG9GYhnY"); Address address3 = new Address("BTS8RiFgs8HkcVPVobHLKEv6yL3iXcC9SWjbPVS15dDAXLG9GYp00"); PublicKey pk1 = address1.getPublicKey(); PublicKey pk2 = address2.getPublicKey(); PublicKey pk3 = address3.getPublicKey(); assertEquals("Public keys must be equal", pk1, pk2); assertNotEquals("Public keys must not be equal", pk1, pk3); }