@Test
public void testGetRows() {
final Set<byte[]> oneRow = ImmutableSortedSet.orderedBy(PtBytes.BYTES_COMPARATOR).add(ROW_BYTES).build();
final ColumnSelection oneColumn = ColumnSelection.create(ImmutableList.of(COL_BYTES));
final Set<byte[]> noRows = ImmutableSortedSet.orderedBy(PtBytes.BYTES_COMPARATOR).build();
final SortedMap<byte[], RowResult<byte[]>> emptyResults =
ImmutableSortedMap.<byte[], RowResult<byte[]>>orderedBy(PtBytes.BYTES_COMPARATOR).build();
final RowResult<byte[]> rowResult = RowResult.of(Cell.create(ROW_BYTES, COL_BYTES), VALUE_BYTES);
final SortedMap<byte[], RowResult<byte[]>> oneResult
= ImmutableSortedMap.<byte[], RowResult<byte[]>>orderedBy(PtBytes.BYTES_COMPARATOR)
.put(ROW_BYTES, rowResult)
.build();
mockery.checking(new Expectations() {
{
oneOf(txn).getRows(table, oneRow, oneColumn);
will(returnValue(oneResult));
oneOf(txn).getRows(table, noRows, oneColumn);
will(returnValue(emptyResults));
}
});
Assert.assertEquals(oneResult, ct.getRows(table, oneRow, oneColumn));
Assert.assertEquals(oneResult, ct.getRows(table, oneRow, oneColumn));
mockery.assertIsSatisfied();
}