BinaryNextHop implements NextHop { @Override public boolean equals(Object obj) { if(!(obj instanceof BinaryNextHop)) return false; BinaryNextHop o = (BinaryNextHop)obj; return (new EqualsBuilder()).append(getAddress(), o.getAddress()).isEquals(); } BinaryNextHop(byte[] address); byte[] getAddress(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(NextHop o); @Override Type getType(); @Override String toString();  }
@Test public void testEquals() { BinaryNextHop a = new BinaryNextHop(new byte[] {1, 2, 3, 4}); BinaryNextHop b = new BinaryNextHop(new byte[] {1, 2, 3, 4}); Assert.assertTrue(a.equals(b)); }
@Test public void testNotEquals() { BinaryNextHop a = new BinaryNextHop(new byte[] {1, 2, 3, 4}); BinaryNextHop b = new BinaryNextHop(new byte[] {1, 2, 3, 4, 5}); Assert.assertFalse(a.equals(b)); }