Source:
public void testCompareOpsNull() throws Exception { byte[] rowKey = dataHelper.randomData("rowKey-"); byte[] nullQual = dataHelper.randomData("null-"); byte[] popluatedQual = dataHelper.randomData("pupulated-"); byte[] otherQual = dataHelper.randomData("other-"); boolean success; Table table = getDefaultTable(); table.put(new Put(rowKey).addColumn(SharedTestEnvRule.COLUMN_FAMILY, popluatedQual, Bytes.toBytes(2000l))); Put someRandomPut = new Put(rowKey).addColumn(SharedTestEnvRule.COLUMN_FAMILY, otherQual, Bytes.toBytes(1l)); success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.LESS, null, someRandomPut); Assert.assertTrue("< null should succeed", success); success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.GREATER, null, someRandomPut); Assert.assertTrue("> null should succeed", success); success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.LESS_OR_EQUAL, null, someRandomPut); Assert.assertTrue("<= null should succeed", success); success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.GREATER_OR_EQUAL, null, someRandomPut); Assert.assertTrue(">= null should succeed", success); success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.EQUAL, null, someRandomPut); Assert.assertTrue("== null should succeed", success); success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.GREATER_OR_EQUAL, new byte[]{Byte.MIN_VALUE}, someRandomPut); Assert.assertFalse("> MIN_BYTES should fail", success); if (sharedTestEnv.isBigtable()) { success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.NOT_EQUAL, null, someRandomPut); Assert.assertFalse("!= null should fail", success); } }

Target:
public void testCompareOpsNull() throws Exception { byte[] rowKey = dataHelper.randomData("rowKey-"); byte[] nullQual = dataHelper.randomData("null-"); byte[] popluatedQual = dataHelper.randomData("pupulated-"); byte[] otherQual = dataHelper.randomData("other-"); boolean success; Table table = getDefaultTable(); table.put(new Put(rowKey).addColumn(SharedTestEnvRule.COLUMN_FAMILY, popluatedQual, Bytes.toBytes(2000l))); Put someRandomPut = new Put(rowKey).addColumn(SharedTestEnvRule.COLUMN_FAMILY, otherQual, Bytes.toBytes(1l)); success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.LESS, null, someRandomPut); Assert.assertTrue("< null should succeed", success); success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.GREATER, null, someRandomPut); Assert.assertTrue("> null should succeed", success); success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.LESS_OR_EQUAL, null, someRandomPut); Assert.assertTrue("<= null should succeed", success); success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.GREATER_OR_EQUAL, null, someRandomPut); Assert.assertTrue(">= null should succeed", success); success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.EQUAL, null, someRandomPut); Assert.assertTrue("== null should succeed", success); success = checkAndPut(rowKey, SharedTestEnvRule.COLUMN_FAMILY, nullQual, CompareOp.GREATER_OR_EQUAL, new byte[]{Byte.MIN_VALUE}, someRandomPut); Assert.assertFalse("> MIN_BYTES should fail", success); }