### Question:
NodeId { @Override public final int hashCode() { return toBytes().hashCode(); }  abstract Bytes toBytes(); abstract String toBase58(); @Override final int hashCode(); @Override final boolean equals(final Object obj); @Override final String toString();  }### Answer:
@Test public void shouldBeEqualToNodeIdsOfDifferentTypes() { final PeerId peerId = PeerId.fromHex(ID); final NodeId libP2PNodeId = new LibP2PNodeId(peerId); final MockNodeId mockNodeId = new MockNodeId(Bytes.fromHexString(ID)); assertThat(mockNodeId).isEqualTo(libP2PNodeId); assertThat(libP2PNodeId).isEqualTo(mockNodeId); assertThat(mockNodeId.hashCode()).isEqualTo(libP2PNodeId.hashCode()); }
@Test public void shouldBeDifferentWhenBytesAreDifferent() { final LibP2PNodeId libP2PNodeId = new LibP2PNodeId(PeerId.fromHex(ID)); final MockNodeId mockNodeId = new MockNodeId(1); assertThat(mockNodeId).isNotEqualTo(libP2PNodeId); assertThat(libP2PNodeId).isNotEqualTo(mockNodeId); assertThat(mockNodeId.hashCode()).isNotEqualTo(libP2PNodeId.hashCode()); }