} // namespace mock
} // namespace
-namespace
-{
-struct DummyObject : public ::mock::Object
-{
-public:
- DummyObject(std::vector<coco::Bag *> &updates) : _updates(updates)
- {
- // DO NOTHING
- }
-
-private:
- void onUpdate(coco::Bag *bag) override { _updates.emplace_back(bag); }
-
-private:
- std::vector<coco::Bag *> &_updates;
-};
-} // namespace
-
TEST_F(ObjectTest, ctor)
{
::mock::Object obj;
// Prepare bag
auto bag = bag_mgr.create(1);
- // Test 'Object' class through 'DummyObject'
- std::vector<coco::Bag *> updates;
- DummyObject obj{updates};
+ // Test 'Object' class through a mock-up object
+ ::mock::Object obj;
obj.info = make_unique<coco::ObjectInfo>();
obj.link = &link;
// 'bag(Bag *)' should affect the return of 'bag(void)'
ASSERT_EQ(obj.bag(), bag);
- ASSERT_EQ(updates.size(), 1);
-
// The dependent object list of each bag should be updated on 'bag(...)' call.
auto bag_info = link.find(bag);