@Test public void testOverlappingKeys() { byte[] empty = HConstants.EMPTY_BYTE_ARRAY; byte[] a = Bytes.toBytes("a"); byte[] b = Bytes.toBytes("b"); byte[] c = Bytes.toBytes("c"); byte[] d = Bytes.toBytes("d"); // overlaps Assert.assertTrue(CellUtil.overlappingKeys(a, b, a, b)); Assert.assertTrue(CellUtil.overlappingKeys(a, c, a, b)); Assert.assertTrue(CellUtil.overlappingKeys(a, b, a, c)); Assert.assertTrue(CellUtil.overlappingKeys(b, c, a, c)); Assert.assertTrue(CellUtil.overlappingKeys(a, c, b, c)); Assert.assertTrue(CellUtil.overlappingKeys(a, d, b, c)); Assert.assertTrue(CellUtil.overlappingKeys(b, c, a, d)); Assert.assertTrue(CellUtil.overlappingKeys(empty, b, a, b)); Assert.assertTrue(CellUtil.overlappingKeys(empty, b, a, c)); Assert.assertTrue(CellUtil.overlappingKeys(a, b, empty, b)); Assert.assertTrue(CellUtil.overlappingKeys(a, b, empty, c)); Assert.assertTrue(CellUtil.overlappingKeys(a, empty, a, b)); Assert.assertTrue(CellUtil.overlappingKeys(a, empty, a, c)); Assert.assertTrue(CellUtil.overlappingKeys(a, b, empty, empty)); Assert.assertTrue(CellUtil.overlappingKeys(empty, empty, a, b)); // non overlaps Assert.assertFalse(CellUtil.overlappingKeys(a, b, c, d)); Assert.assertFalse(CellUtil.overlappingKeys(c, d, a, b)); Assert.assertFalse(CellUtil.overlappingKeys(b, c, c, d)); Assert.assertFalse(CellUtil.overlappingKeys(b, c, c, empty)); Assert.assertFalse(CellUtil.overlappingKeys(b, c, d, empty)); Assert.assertFalse(CellUtil.overlappingKeys(c, d, b, c)); Assert.assertFalse(CellUtil.overlappingKeys(c, empty, b, c)); Assert.assertFalse(CellUtil.overlappingKeys(d, empty, b, c)); Assert.assertFalse(CellUtil.overlappingKeys(b, c, a, b)); Assert.assertFalse(CellUtil.overlappingKeys(b, c, empty, b)); Assert.assertFalse(CellUtil.overlappingKeys(b, c, empty, a)); Assert.assertFalse(CellUtil.overlappingKeys(a, b, b, c)); Assert.assertFalse(CellUtil.overlappingKeys(empty, b, b, c)); Assert.assertFalse(CellUtil.overlappingKeys(empty, a, b, c)); }