vendredi 19 octobre 2018

QNX Momentics: GoogleMock - Return has value, in function returning void error

I need to write mock methods for a class, provided to us by a third party supplier. The class, that I need to mock has virtual methods and I am mocking them in my mock class.

This is the original class:

    class Derived : public Base
{

public:
    virtual void addResource(const Resource& resource, std::string resourceURL);
    virtual void removeResource(const Resource& resource);
...
};

Just to let you know, these two methods are virtual in the Base class, too.

This is the Mock class:

class MockDerived : public Derived {
 public:
     MockDerived (std::string name);

  MOCK_METHOD2(addResource,
      void(const Resource& resource, std::string resourceURL));

  MOCK_METHOD1(removeResource,
      void(const Resource& resource));
};

All this works fine. I am executing tests without a problem. However, in QNX Momentics (The QNX version is 7.0), which is really just Eclipse, it gives me the following error:

Return has value, in function returning void

Anybody has an idea what I need to do in order to remove the errors. It still works, but it is annoying to have this error and who knows what can go wrong in the future.

Aucun commentaire:

Enregistrer un commentaire