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