ColumnValue implements Serializable, Comparable<ColumnValue> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof ColumnValue) { ColumnValue ocv = (ColumnValue) o; return column.equals(ocv.column) && val.equals(ocv.val); } return false; } ColumnValue(Column col, Bytes val);  ColumnValue(Column col, CharSequence val); Column getColumn(); Bytes getValue(); String getsValue(); @Override int compareTo(ColumnValue o); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() { Column c1 = new Column("f1", "q1"); Column c2 = new Column("f2", "q1"); Column c3 = new Column("f1", "q2"); Column c4 = new Column("f2", "q2"); ColumnValue cv = new ColumnValue(c1, "v1"); Assert.assertEquals(cv, cv); Assert.assertEquals(cv.hashCode(), cv.hashCode()); Assert.assertEquals(new ColumnValue(c1, "v1"), cv); Assert.assertEquals(new ColumnValue(c1, "v1").hashCode(), cv.hashCode()); Assert.assertNotEquals(new ColumnValue(c1, "v2"), cv); Assert.assertNotEquals(new ColumnValue(c1, "v2").hashCode(), cv.hashCode()); for (Column c : Arrays.asList(c2, c3, c4)) { for (String v : Arrays.asList("v1", "v2")) { ColumnValue ocv = new ColumnValue(c, v); Assert.assertNotEquals(ocv, cv); Assert.assertNotEquals(ocv.hashCode(), cv.hashCode()); } } Assert.assertNotEquals(cv, c1); Assert.assertNotEquals(cv, "v1"); }