I have mocked virtual method returning istream&
. I'd like to use it in a testcase. How to return some value?
The problem is that istream
is noncopyable.
I try something like this:
TEST(x, y)
{
MockClass mock;
std::istringstream str("Some text");
EXPECT_CALL(mock, m(_)).WillOnce(Return(str)); // m method returns std::istream&
sut.callMethod();
}