AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Protected Attributes | List of all members
alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest Class Reference

Test harness for AlexaInterfaceMessageSender class. More...

Inheritance diagram for alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest:
Collaboration graph
[legend]

Public Member Functions

void SetUp () override
 Set up/tear down the test harness for running a test. More...
 
void TearDown () override
 
AVSMessageEndpoint buildTestEndpoint (void)
 
CapabilityTag buildTestTag (void)
 
CapabilityState buildTestState (void)
 
std::shared_ptr< AlexaInterfaceMessageSendercreateMessageSender (void)
 
bool removeMessageId (Document *document, std::string *messageId)
 
bool removeEventCorrelationToken (Document *document, std::string *eventCorrelationToken)
 
bool expectEventSent (const std::shared_ptr< AlexaInterfaceMessageSender > &sender, const std::string &jsonEventString, MessageRequestObserverInterface::Status sendStatus, std::function< void()> triggerOperation)
 
bool expectEventSentOnInvalidContext (const std::shared_ptr< AlexaInterfaceMessageSender > &sender, const std::string &jsonEventString, MessageRequestObserverInterface::Status sendStatus, std::function< void()> triggerOperation)
 
bool expectEventSentWithoutContext (const std::shared_ptr< AlexaInterfaceMessageSender > &sender, const std::string &jsonEventString, MessageRequestObserverInterface::Status sendStatus, std::function< void()> triggerOperation)
 
bool expectEventNotSentOnInvalidContext (const std::shared_ptr< AlexaInterfaceMessageSender > &sender, const std::string &jsonEventString, MessageRequestObserverInterface::Status sendStatus, std::function< void()> triggerOperation)
 
bool checkEventJson (std::string jsonEventString, std::string testEventString)
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 

Protected Attributes

std::shared_ptr< avsCommon::sdkInterfaces::test::MockContextManagerm_mockContextManager
 Context manager mock. More...
 
std::shared_ptr< MockMessageSenderm_messageSender
 Message sender mock to track messages being sent. More...
 
AVSContext m_context
 Test AVSContext object. More...
 

Additional Inherited Members

- Public Types inherited from testing::Test
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
- Protected Member Functions inherited from testing::Test
 Test ()
 

Detailed Description

Test harness for AlexaInterfaceMessageSender class.

Member Function Documentation

◆ buildTestEndpoint()

AVSMessageEndpoint alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::buildTestEndpoint ( void  )

Build a test AVSMessageEndpoint object.

Returns
the test object

◆ buildTestState()

CapabilityState alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::buildTestState ( void  )

Build a test CapabilityTag object.

Returns
the test object

◆ buildTestTag()

CapabilityTag alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::buildTestTag ( void  )

Build a test CapabilityTag object.

Returns
the test object

◆ checkEventJson()

bool alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::checkEventJson ( std::string  jsonEventString,
std::string  testEventString 
)

Check to see that an event JSON matches the expected result after removing fields that are always different.

Parameters
jsonEventStringthe event JSON string to check
testEventStringthe event JSON string to test against
Returns
true on success, false on failure

◆ createMessageSender()

std::shared_ptr< AlexaInterfaceMessageSender > alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::createMessageSender ( void  )

Helper function to create an AlexaInterfaceMessageSender and set the expects for it.

Returns
pointer to the new AlexaInterfaceMessageSender

◆ expectEventNotSentOnInvalidContext()

bool alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::expectEventNotSentOnInvalidContext ( const std::shared_ptr< AlexaInterfaceMessageSender > &  sender,
const std::string &  jsonEventString,
MessageRequestObserverInterface::Status  sendStatus,
std::function< void()>  triggerOperation 
)

Setup mocks for an event that should not be sent if context is invalid.

Parameters
jsonEventStringthe expected event as a JSON string
sendStatusthe send status result to be returned
triggerOperationthe function to call to start the sending process
Returns
true on success, false on failure

◆ expectEventSent()

bool alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::expectEventSent ( const std::shared_ptr< AlexaInterfaceMessageSender > &  sender,
const std::string &  jsonEventString,
MessageRequestObserverInterface::Status  sendStatus,
std::function< void()>  triggerOperation 
)

Setup mocks for sending an event that expects the event to be sent on the happy path.

Parameters
senderthe AlexaInterfaceMessageSender to use
jsonEventStringthe expected event as a JSON string
sendStatusthe send status result to be returned
triggerOperationthe function to call to start the sending process
Returns
true on success, false on failure

◆ expectEventSentOnInvalidContext()

bool alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::expectEventSentOnInvalidContext ( const std::shared_ptr< AlexaInterfaceMessageSender > &  sender,
const std::string &  jsonEventString,
MessageRequestObserverInterface::Status  sendStatus,
std::function< void()>  triggerOperation 
)

Setup mocks for sending an event, even if the context is invalid.

Parameters
jsonEventStringthe expected event as a JSON string
sendStatusthe send status result to be returned
triggerOperationthe function to call to start the sending process
Returns
true on success, false on failure

◆ expectEventSentWithoutContext()

bool alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::expectEventSentWithoutContext ( const std::shared_ptr< AlexaInterfaceMessageSender > &  sender,
const std::string &  jsonEventString,
MessageRequestObserverInterface::Status  sendStatus,
std::function< void()>  triggerOperation 
)

Setup mocks for sending an event that does not require context at all.

Parameters
jsonEventStringthe expected event as a JSON string
sendStatusthe send status result to be returned
triggerOperationthe function to call to start the sending process
Returns
true on success, false on failure

◆ removeEventCorrelationToken()

bool alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::removeEventCorrelationToken ( Document *  document,
std::string *  eventCorrelationToken 
)

Helper function to remove the eventCorrelationToken.

Parameters
documentThe document from which to remove the eventCorrelationToken.
eventCorrelationTokenThe eventCorrelationToken that was removed (if successful).
Returns
bool Indicates whether removing the eventCorrelationToken was successful.

◆ removeMessageId()

bool alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::removeMessageId ( Document *  document,
std::string *  messageId 
)

Helper function to remove the messageId.

Parameters
documentThe document from which to remove the messageId.
messageIdThe messageId that was removed (if successful).
Returns
bool Indicates whether removing the messageId was successful.

◆ SetUp()

void alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::SetUp ( )
overridevirtual

Set up/tear down the test harness for running a test.

Reimplemented from testing::Test.

◆ TearDown()

void alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::TearDown ( )
overridevirtual

Reimplemented from testing::Test.

Member Data Documentation

◆ m_context

AVSContext alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::m_context
protected

Test AVSContext object.

◆ m_messageSender

std::shared_ptr<MockMessageSender> alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::m_messageSender
protected

Message sender mock to track messages being sent.

◆ m_mockContextManager

std::shared_ptr<avsCommon::sdkInterfaces::test::MockContextManager> alexaClientSDK::capabilityAgents::alexa::test::AlexaInterfaceMessageSenderTest::m_mockContextManager
protected

Context manager mock.


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