How to Mock AWS::Transfer::TransferManager class using gmock?

549 Views Asked by At

I am using AWS C++ SDK to download/upload files on AWS using AWS::Transfer::TransferManager. I want to unit test client class which makes uses of TransferManager and It requires to mock TransferManager. The AWS TransferManager class is concrete class, not an abstract class. How do I mock it?

1

There are 1 best solutions below

0
On

See this answer describing a technique called hi-perf dependency injection.

Basically it allows you to define dependency injection of non-virtual class at compile time (and not at runtime, as with regular depencendy injection) using templates. Downside is that you'll have to have it in the header file.