Is it possible to make a mock class copiable in Google Test Framework?
I've seen that the default copy constructor and copy assignment operator are deleted once that the MOCK_METHOD macros are used.
Is there a way to workaround that?
Copiable mocks in Google Test Framework
303 Views Asked by nyarlathotep108 At
1
There are 1 best solutions below
Related Questions in C++
- C++ using std::vector across boundaries
- Linked list without struct
- Connecting Signal QML to C++ (Qt5)
- how to get the reference of struct soap inherited in C++ Proxy/Service class
- Why we can't assign value to pointer
- Conversion of objects in c++
- shared_ptr: "is not a type" error
- C++ template using pointer and non pointer arguments in a QVector
- C++ SFML 2.2 vectors
- Lifetime of temporary objects
- I want to be able to use 4 different variables in a select statement in c ++
- segmentation fault: 11, extracting data in vector
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- How can I print all the values in this linked list inside a hash table?
- Configured TTL for A record(s) backing CNAME records
Related Questions in MOCKING
- PHPunit call magic methods
- AngularJS Unit Testing - multiple mocks and providers
- How to use Sinon.js FakeXMLHttpRequest with superagent?
- Automatically wrap C/C++ function at compile-time with annotation
- How to mock specific RequireJs dependencies while unit testing
- Create mock based on existed real instance
- Overriding function with Sinon.mock?
- Spring MockRestServiceServer handling multiple requests to the same URI (auto-discovery)
- Sling Mock is not allowing to get ResourceResolverFactory
- Swift Mocking Class
- How can I mock methods of @InjectMocks class?
- Can I inject primitive variable into mocked class using annotation?
- How to capture field value when a method of a class is called in Python?
- Unit testing a fluent interface with Mockito
- Mocked repository does not trigger as expected
Related Questions in COPY-CONSTRUCTOR
- Copy constructor required to be explicity defined with mutex
- Shared dereferenced pointer value displays different results (when applying implicit copy constructor). Why?
- Constructor and const reference
- Copy Constructor Undefined Call
- tracing calls to copy constructor
- Set struct variable nested inside a class in a copy constructor
- Non-const copy constructor
- C++ virtual base classes: parent's copy constructor doesn't get called
- How to understand copy-constructior function?
- does default copy constructor handle const?
- How can I create an Arraylist which not refers to another one?
- std::is_copy/move_constructible fails even though copy/move constructors are defaulted
- Copy constructor invoked 2 times, not 3 as expected?
- Why destructor is not getting called for anonymous objects?
- Overloading Constructor Not Working for Singly Linked List
Related Questions in GOOGLETEST
- GoogleTest several C++ projects in the same solution
- pthread-related errors when upgrading test from GoogleTest to GoogleMock (Ubuntu 14)
- gtest - How to run the same code in the beginning of some functions
- Specifying method's behaviour via EXPECT_CALL vs in body
- InvalidOperationException in System.ServiceModel.dll using Visual Studio 2015 with C++, GoogleTest Framework and Google Test Adapter
- Can I force cygwin to show colors like dos prompt when running GoogleTest?
- Working with Gtest and Gmock on Windows
- vcpkg does not work for google test
- C++ Google Mock - EXPECT_CALL() - expectation not working when not called directly
- visual studio 2010 express gtest c++
- Gtest, equals object
- Gtest and Gmock - double free or corruption
- Cucumber-cpp step defiinition runner exits immediately
- gtest installed with conan: undefined reference to `testing::internal::GetBoolAssertionFailureMessage`
- googletest & cmake - Undefined symbols for architecture x86_64
Related Questions in COPY-ASSIGNMENT
- Safe some memory when passing and assigning
- thread-safe copy assignment operator for smart pointer class
- Copy constructor/Assignment operator confusion when initializing object
- constructing a std::function object from a type with a variadic template constructor
- understanding copy constructor and copy assignment operator
- Is it a good practice to point to a new address on free store when dynamicly allocating?
- Why std::string a; std::string b; a + b = "abc"; OK?
- Value assignment isn't working as expected
- Use copy constructor while user-declared move constructor is present
- C++ destructor called after calling constructor
- placement new to circumvent assignment constructor
- Copy assignment operator, vector
- For a class, what is the difference between default-initialization, and copy-initialization to a value-initialized prvalue?
- Inherited addition assignment op., how do I return the proper type?
- Default copy behavior with array of objects
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I cannot imagine any use case for copying mock objects. When you want to mimic real object with mock object - you shall have access to the very same object from code under test and from your test case code - so why copying needed?
Anyway - I see one method to make copying of mock object: You have to define wrapper on mock object - which shall be kept by
std::shared_ptr.An example: