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