AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::notifierInterfaces::test::MockNotifier< ObserverType > Class Template Reference

Mock class that implements NotifierInterface. More...

#include <MockNotifier.h>

Inheritance diagram for alexaClientSDK::notifierInterfaces::test::MockNotifier< ObserverType >:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::notifierInterfaces::test::MockNotifier< ObserverType >:
Collaboration graph
[legend]

Public Member Functions

 MOCK_METHOD1_T (addObserver, void(const std::shared_ptr< ObserverType > &observer))
 
 MOCK_METHOD1_T (removeObserver, void(const std::shared_ptr< ObserverType > &observer))
 
 MOCK_METHOD1_T (addWeakPtrObserver, void(const std::weak_ptr< ObserverType > &observer))
 
 MOCK_METHOD1_T (removeWeakPtrObserver, void(const std::weak_ptr< ObserverType > &observer))
 
 MOCK_METHOD1_T (notifyObservers, void(std::function< void(const std::shared_ptr< ObserverType > &)>))
 
 MOCK_METHOD1_T (notifyObserversInReverse, bool(std::function< void(const std::shared_ptr< ObserverType > &)>))
 
 MOCK_METHOD1_T (setAddObserverFunction, void(std::function< void(const std::shared_ptr< ObserverType > &)>))
 
- Public Member Functions inherited from alexaClientSDK::notifierInterfaces::NotifierInterface< ObserverType >
virtual ~NotifierInterface ()=default
 
virtual void addObserver (const std::shared_ptr< ObserverType > &observer)=0
 Add an observer. More...
 
virtual void removeObserver (const std::shared_ptr< ObserverType > &observer)=0
 Remove an observer. More...
 
virtual void addWeakPtrObserver (const std::weak_ptr< ObserverType > &observer)=0
 Add a weak reference to an observer. More...
 
virtual void removeWeakPtrObserver (const std::weak_ptr< ObserverType > &observer)=0
 Remove an observer. More...
 
virtual void notifyObservers (std::function< void(const std::shared_ptr< ObserverType > &)> notify)=0
 Notify the observers in the order that they were added. More...
 
virtual bool notifyObserversInReverse (std::function< void(const std::shared_ptr< ObserverType > &)> notify)=0
 Notify the observers in the reverse order that they were added. More...
 
virtual void setAddObserverFunction (std::function< void(const std::shared_ptr< ObserverType > &)> postAddFunc)=0
 Set a function for notifications on an observer additions. More...
 

Detailed Description

template<typename ObserverType>
class alexaClientSDK::notifierInterfaces::test::MockNotifier< ObserverType >

Mock class that implements NotifierInterface.

To make Expect calls against the observer you will need to set a ON_CALL WillByDefault assertion that will pass the args to the observer.

ON_CALL(MockNotifier, notifyObservers(_))
.WillByDefault(Invoke(
[this](std::function<void(
const std::shared_ptr<ObserverType>&)>
notifyFn) { notifyFn(observer); }));

Member Function Documentation

◆ MOCK_METHOD1_T() [1/7]

template<typename ObserverType>
alexaClientSDK::notifierInterfaces::test::MockNotifier< ObserverType >::MOCK_METHOD1_T ( addObserver  ,
void(const std::shared_ptr< ObserverType > &observer)   
)

◆ MOCK_METHOD1_T() [2/7]

template<typename ObserverType>
alexaClientSDK::notifierInterfaces::test::MockNotifier< ObserverType >::MOCK_METHOD1_T ( removeObserver  ,
void(const std::shared_ptr< ObserverType > &observer)   
)

◆ MOCK_METHOD1_T() [3/7]

template<typename ObserverType>
alexaClientSDK::notifierInterfaces::test::MockNotifier< ObserverType >::MOCK_METHOD1_T ( addWeakPtrObserver  ,
void(const std::weak_ptr< ObserverType > &observer)   
)

◆ MOCK_METHOD1_T() [4/7]

template<typename ObserverType>
alexaClientSDK::notifierInterfaces::test::MockNotifier< ObserverType >::MOCK_METHOD1_T ( removeWeakPtrObserver  ,
void(const std::weak_ptr< ObserverType > &observer)   
)

◆ MOCK_METHOD1_T() [5/7]

template<typename ObserverType>
alexaClientSDK::notifierInterfaces::test::MockNotifier< ObserverType >::MOCK_METHOD1_T ( notifyObservers  ,
void(std::function< void(const std::shared_ptr< ObserverType > &)>)   
)

◆ MOCK_METHOD1_T() [6/7]

template<typename ObserverType>
alexaClientSDK::notifierInterfaces::test::MockNotifier< ObserverType >::MOCK_METHOD1_T ( notifyObserversInReverse  ,
bool(std::function< void(const std::shared_ptr< ObserverType > &)>)   
)

◆ MOCK_METHOD1_T() [7/7]

template<typename ObserverType>
alexaClientSDK::notifierInterfaces::test::MockNotifier< ObserverType >::MOCK_METHOD1_T ( setAddObserverFunction  ,
void(std::function< void(const std::shared_ptr< ObserverType > &)>)   
)

The documentation for this class was generated from the following file:

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0