NodeId implements Comparable<NodeId> { @Override public String toString() { return "NodeId{ id=0x" + Long.toHexString(id).toUpperCase() + " }"; } NodeId();  NodeId(long id);  NodeId(NodeId nid); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(NodeId o); @Override String toString(); final long id; }
@Test public void toStringTest() { NodeId a = new NodeId(1); Assert.assertEquals("NodeId{ id=0x1 }", a.toString()); NodeId b = new NodeId(10); Assert.assertEquals("NodeId{ id=0xA }", b.toString()); }