Skip to content

Commit

Permalink
Rename class QofMockQuery to QofFakeQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Gruber committed Jul 9, 2020
1 parent bbfc30d commit 841111e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions libgnucash/engine/mocks/fake-qofquery.cpp
Expand Up @@ -24,7 +24,7 @@ void
qof_query_set_book (QofQuery *query, QofBook *book)
{
ASSERT_TRUE(QOF_IS_MOCK_BOOK(book));
((QofMockQuery*)query)->setBook(book);
((QofFakeQuery*)query)->setBook(book);
}

GList *
Expand All @@ -33,7 +33,7 @@ qof_query_run (QofQuery *query)
GList *matching_objects = NULL;

// \todo use typed mock objects
auto matchingObjects = ((QofMockQuery*)query)->run();
auto matchingObjects = ((QofFakeQuery*)query)->run();

for (auto object : matchingObjects)
{
Expand All @@ -52,17 +52,17 @@ xaccQueryAddDateMatchTT (
time64 ett,
QofQueryOp op)
{
((QofMockQuery*)query)->addDateMatchTT(use_start, stt, use_end, ett, op);
((QofFakeQuery*)query)->addDateMatchTT(use_start, stt, use_end, ett, op);
}

void
xaccQueryAddSingleAccountMatch(QofQuery *query, Account *acc, QofQueryOp op)
{
((QofMockQuery*)query)->addSingleAccountMatch(acc, op);
((QofFakeQuery*)query)->addSingleAccountMatch(acc, op);
}

void
qof_query_destroy (QofQuery *query)
{
((QofMockQuery*)query)->destroy();
((QofFakeQuery*)query)->destroy();
}
10 changes: 5 additions & 5 deletions libgnucash/engine/mocks/fake-qofquery.h
Expand Up @@ -11,12 +11,12 @@ extern "C"
#include <Query.h>
}

// mock up for QofQuery
// hint: class QofMockQuery can not be derived from QofQuery, since struct _QofQuery is not public
class QofMockQuery
// Fake object providing functionality similar to QofQuery
// Note: QofQuery is a typedef for struct _QofQuery, which is is not public
class QofFakeQuery
{
public:
QofMockQuery() {};
QofFakeQuery() {};

MOCK_METHOD1(setBook, void(QofBook*));
MOCK_METHOD0(destroy, void());
Expand All @@ -40,7 +40,7 @@ class QofQueryFactory
{
public:
// MOCK_METHOD0(createForSplit, MockQofQueryWithType<Split>*());
MOCK_METHOD0(create, QofMockQuery*());
MOCK_METHOD0(create, QofFakeQuery*());
} qof_query_factory;

#endif

0 comments on commit 841111e

Please sign in to comment.