Index: /home/sebastien/projects/java/hbase-trunk/src/test/org/apache/hadoop/hbase/HBaseTestCase.java =================================================================== --- /home/sebastien/projects/java/hbase-trunk/src/test/org/apache/hadoop/hbase/HBaseTestCase.java (revision 674660) +++ /home/sebastien/projects/java/hbase-trunk/src/test/org/apache/hadoop/hbase/HBaseTestCase.java (working copy) @@ -566,25 +566,47 @@ } } - protected void assertCellEquals(final HRegion region, final byte [] row, - final byte [] column, final long timestamp, final String value) + protected void assertCellEquals(final HRegion region, final byte[] row, + final byte[] column, final long timestamp, final String value) + throws IOException { + assertCellEqualsWithGetFull(region, row, column, timestamp, value); + assertCellEqualsWithGet(region, row, column, timestamp, value); + } + + private void assertCellEqualsWithGetFull(final HRegion region, final byte[] row, + final byte[] column, final long timestamp, final String value) throws IOException { - Map result = region.getFull(row, null, timestamp); - Cell cell_value = result.get(column); + Map result = region.getFull(row, null, timestamp); + Cell cellValue = result.get(column); + assertCellEqualsCommon(region, row, column, timestamp, value, cellValue); + } + + private void assertCellEqualsWithGet(final HRegion region, final byte[] row, + final byte[] column, final long timestamp, final String value) + throws IOException { + Cell[] result = region.get(row, column, timestamp, 1); + Cell cellValue = (result == null || result.length == 0) ? null : result[0]; + assertCellEqualsCommon(region, row, column, timestamp, value, cellValue); + } + + protected void assertCellEqualsCommon(final HRegion region, final byte [] row, + final byte [] column, final long timestamp, final String value, + final Cell cellValue) + throws IOException { if(value == null){ - assertEquals(column.toString() + " at timestamp " + timestamp, null, cell_value); + assertEquals(column.toString() + " at timestamp " + timestamp, null, cellValue); } else { - if (cell_value == null) { + if (cellValue == null) { fail(column.toString() + " at timestamp " + timestamp + "\" was expected to be \"" + value + " but was null"); - } - if (cell_value != null) { - assertEquals(column.toString() + " at timestamp " - + timestamp, value, new String(cell_value.getValue())); + } + if (cellValue != null) { + assertEquals(column.toString() + " at timestamp " + + timestamp, value, new String(cellValue.getValue())); } - } + } } - + /** * Initializes parameters used in the test environment: *