Classes
MockDataConnection
A class to mock google::cloud::bigtable::DataConnection
.
Functions
MakeRowReader(std::vector< bigtable::Row >, Status)
Returns a RowReader
with a fixed output stream.
This factory function is offered for customers to mock the output of Table::ReadRows(...)
in their tests.
TEST(ReadRowsTest, Success) {
using ::google::cloud::StatusOr;
using cbt = ::google::cloud::bigtable;
using cbtm = ::google::cloud::bigtable_mocks;
std::vector<cbt::Row> rows = {cbt::Row("r1", {}), cbt::Row("r2", {})};
auto mock = std::shared_ptr<cbtm::MockDataConnection>();
EXPECT_CALL(*mock, ReadRowsFull)
.WillOnce(Return(cbtm::MakeRowReader(rows)));
auto table = cbt::Table(mock);
auto reader = table.ReadRows(...);
// Verify your code works when reading rows: {"r1", "r2"}
}
Parameters | |
---|---|
Name | Description |
rows |
a vector containing the |
final_status |
the final Status of the stream. Defaults to OK. |
Returns | |
---|---|
Type | Description |
bigtable::RowReader |