@SuppressWarnings("SelfComparison")
  @Test
  public void testCompareTo() {
    ServerName hsa1 = ServerName.valueOf("localhost", 1234, -1L);
    HRegionLocation hsl1 = new HRegionLocation(RegionInfoBuilder.FIRST_META_REGIONINFO, hsa1);
    ServerName hsa2 = ServerName.valueOf("localhost", 1235, -1L);
    HRegionLocation hsl2 = new HRegionLocation(RegionInfoBuilder.FIRST_META_REGIONINFO, hsa2);
    assertEquals(0, hsl1.compareTo(hsl1));
    assertEquals(0, hsl2.compareTo(hsl2));
    int compare1 = hsl1.compareTo(hsl2);
    int compare2 = hsl2.compareTo(hsl1);
    assertTrue((compare1 > 0) ? compare2 < 0 : compare2 > 0);
  }
HRegionLocations are equal if they have the same 'location' -- i.e. host and port -- even if
they are carrying different regions. Verify that is indeed the case.
hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java