### Question:
PairOfStringLong implements WritableComparable<PairOfStringLong> { public boolean equals(Object obj) { PairOfStringLong pair = (PairOfStringLong) obj; return leftElement.equals(pair.getLeftElement()) && rightElement == pair.getRightElement(); } PairOfStringLong();  PairOfStringLong(String left, long right); void readFields(DataInput in); void write(DataOutput out); String getLeftElement(); long getRightElement(); String getKey(); long getValue(); void set(String left, long right); boolean equals(Object obj); int compareTo(PairOfStringLong pair); int hashCode(); String toString(); PairOfStringLong clone();  }### Answer:
@Test public void testComparison2() throws IOException { WritableComparator comparator = new PairOfStringLong.Comparator(); PairOfStringLong pair1 = new PairOfStringLong("hi", 1L); PairOfStringLong pair2 = new PairOfStringLong("hi", 1L); PairOfStringLong pair3 = new PairOfStringLong("hi", 0L); PairOfStringLong pair4 = new PairOfStringLong("a", 0L); PairOfStringLong pair5 = new PairOfStringLong("hi", 2L); assertTrue(pair1.equals(pair2)); assertFalse(pair1.equals(pair3)); assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair2) == 0); assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair3) > 0); assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair4) > 0); assertTrue(WritableComparatorTestHarness.compare(comparator, pair1, pair5) < 0); assertTrue(WritableComparatorTestHarness.compare(comparator, pair3, pair4) > 0); assertTrue(WritableComparatorTestHarness.compare(comparator, pair4, pair5) < 0); }