Package ai.tock.bot.test
Class BotBusMock
-
- All Implemented Interfaces:
-
ai.tock.bot.engine.BotBus,ai.tock.bot.engine.Bus,ai.tock.bot.engine.I18nTranslator,ai.tock.translator.I18nKeyProvider
public class BotBusMock implements BotBusA Bus mock used in unit tests.
The answers of the bot are available in the answers property.
-
-
Field Summary
Fields Modifier and Type Field Description private final List<BotBusMockLog>answersprivate final BotBusMockLogfirstAnswerprivate final BotBusMockLogsecondAnswerprivate final BotBusMockLogthirdAnswerprivate final BotBusMockLoglastAnswerprivate final List<BotBusMockLog>busAnswersprivate final BotBusMockLogfirstBusAnswerprivate final BotBusMockLogsecondBusAnswerprivate final BotBusMockLogthirdBusAnswerprivate final BotBusMockLoglastBusAnswerprivate final IntegercurrentAnswerIndexprivate UserTimelineuserTimelineprivate Dialogdialogprivate final DialogcurrentDialogprivate Storystoryprivate BotDefinitionbotDefinitionprivate I18nKeyProvideri18nProviderprivate UserInterfaceTypeuserInterfaceTypeprivate ConnectorTypeconnectorTypeprivate ConnectorDataconnectorDataprivate final TranslatorEnginetranslatorprivate final StringapplicationIdprivate final PlayerIdbotIdprivate final PlayerIduserIdprivate final UserPreferencesuserPreferencesprivate final LocaleuserLocaleprivate ConnectorTypesourceConnectorTypeprivate ConnectorTypetargetConnectorTypeprivate final ConnectorunderlyingConnectorprivate final Map<String, EntityStateValue>entitiesprivate IntentAwareintentprivate NextUserActionStatenextUserActionStateprivate final BotBusMockContextcontextprivate final Actionactionprivate final StringcontextIdprivate final IntentAwarecurrentIntentprivate StoryStep<out StoryHandlerDefinition>stepprivate final StringstepNameprivate final Booleantestprivate final StringuserText
-
Constructor Summary
Constructors Constructor Description BotBusMock(BotBusMockContext context, Action action)
-
Method Summary
Modifier and Type Method Description final List<BotBusMockLog>getAnswers()final BotBusMockLoggetFirstAnswer()final BotBusMockLoggetSecondAnswer()final BotBusMockLoggetThirdAnswer()final BotBusMockLoggetLastAnswer()final List<BotBusMockLog>getBusAnswers()final BotBusMockLoggetFirstBusAnswer()final BotBusMockLoggetSecondBusAnswer()final BotBusMockLoggetThirdBusAnswer()final BotBusMockLoggetLastBusAnswer()IntegergetCurrentAnswerIndex()UserTimelinegetUserTimeline()UnitsetUserTimeline(UserTimeline userTimeline)DialoggetDialog()UnitsetDialog(Dialog dialog)DialoggetCurrentDialog()StorygetStory()UnitsetStory(Story story)BotDefinitiongetBotDefinition()UnitsetBotDefinition(BotDefinition botDefinition)I18nKeyProvidergetI18nProvider()UnitsetI18nProvider(I18nKeyProvider i18nProvider)UserInterfaceTypegetUserInterfaceType()UnitsetUserInterfaceType(UserInterfaceType userInterfaceType)final ConnectorTypegetConnectorType()final UnitsetConnectorType(ConnectorType connectorType)ConnectorDatagetConnectorData()UnitsetConnectorData(ConnectorData connectorData)final TranslatorEnginegetTranslator()StringgetApplicationId()PlayerIdgetBotId()PlayerIdgetUserId()UserPreferencesgetUserPreferences()LocalegetUserLocale()ConnectorTypegetSourceConnectorType()UnitsetSourceConnectorType(ConnectorType sourceConnectorType)ConnectorTypegetTargetConnectorType()UnitsetTargetConnectorType(ConnectorType targetConnectorType)ConnectorgetUnderlyingConnector()Map<String, EntityStateValue>getEntities()IntentAwaregetIntent()UnitsetIntent(IntentAware intent)NextUserActionStategetNextUserActionState()UnitsetNextUserActionState(NextUserActionState nextUserActionState)final BotBusMockContextgetContext()ActiongetAction()BooleanisCompatibleWith(ConnectorType connectorType)BotBussend(Event event, Long delayInMs)BotBussend(Action action, Long delay)final BotBusMockrun()Run the StoryHandler of the current story. final BotBusMockcheckEndCalled()Throws an exception if the end() is not called final BotBusMockaddActionEntity(EntityValue contextValue)Add an entity set in the current action. final BotBusMockaddActionEntity(Entity entity, Value newValue)Add an entity set in the current action. final BotBusMockaddActionEntity(Entity entity, String textContent)Simulate an action entity. UnitsendAction(Action action, Long delay)<T extends Any> TgetBusContextValue(String name)Returns the non persistent current value. UnitsetBusContextValue(String key, Object value)Update the non persistent current value. BotBusend(Action action, Long delay)final SendSentencecreateBotSentence(CharSequence plainText)BotBussendRawText(CharSequence plainText, Long delay)BotBussendDebugData(String title, Object data)BotBuswithPriority(ActionPriority priority)BotBuswithNotificationType(ActionNotificationType notificationType)BotBuswithVisibility(ActionVisibility visibility)BotBuswithMessage(ConnectorType connectorType, Function0<ConnectorMessage> messageProvider)BotBuswithMessage(ConnectorType connectorType, String connectorId, Function0<ConnectorMessage> messageProvider)UnitreloadProfile()TranslatedSequencetranslate(I18nLabelValue key)UnitmarkAsUnknown()final ActionapplyBotAnswerInterceptor(Action a)Update Action using BotAnswerInterceptor final Unitassert(ConnectorMessageProvider messages)Assert that logs contains specified messages. -
Methods inherited from class ai.tock.bot.engine.BotBus
booleanChoice, changeContextValue, changeContextValue, changeEntityText, changeEntityValue, changeEntityValue, changeEntityValue, choice, contextValue, contextValue, createMetric, defaultDelay, end, end, end, end, end, end, endRawText, entityText, entityText, entityValue, entityValue, entityValueDetails, entityValueDetails, getBusContextValue, getContextId, getCurrentIntent, getStep, getStepName, getTest, getTrackedStoryId, getUserText, handleAndSwitchStory, hasActionEntity, hasActionEntity, hasChoiceValue, i18n, i18nKey, i18nKey, isChoiceAction, isFeatureEnabled, isIntent, nlpStats, removeAllEntityValues, removeEntityValue, removeEntityValue, resetDialogState, send, send, send, send, send, send, setBusContextValue, setStep, skipAnswer, switchStory, withMessage -
Methods inherited from class ai.tock.bot.engine.I18nTranslator
translate, translate, translateAndReturnBlankAsNull -
Methods inherited from class ai.tock.translator.I18nKeyProvider
i18n -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
BotBusMock
BotBusMock(BotBusMockContext context, Action action)
-
-
Method Detail
-
getAnswers
final List<BotBusMockLog> getAnswers()
-
getFirstAnswer
final BotBusMockLog getFirstAnswer()
-
getSecondAnswer
final BotBusMockLog getSecondAnswer()
-
getThirdAnswer
final BotBusMockLog getThirdAnswer()
-
getLastAnswer
final BotBusMockLog getLastAnswer()
-
getBusAnswers
final List<BotBusMockLog> getBusAnswers()
-
getFirstBusAnswer
final BotBusMockLog getFirstBusAnswer()
-
getSecondBusAnswer
final BotBusMockLog getSecondBusAnswer()
-
getThirdBusAnswer
final BotBusMockLog getThirdBusAnswer()
-
getLastBusAnswer
final BotBusMockLog getLastBusAnswer()
-
getCurrentAnswerIndex
Integer getCurrentAnswerIndex()
-
getUserTimeline
UserTimeline getUserTimeline()
-
setUserTimeline
Unit setUserTimeline(UserTimeline userTimeline)
-
getDialog
Dialog getDialog()
-
getCurrentDialog
Dialog getCurrentDialog()
-
getStory
Story getStory()
-
getBotDefinition
BotDefinition getBotDefinition()
-
setBotDefinition
Unit setBotDefinition(BotDefinition botDefinition)
-
getI18nProvider
I18nKeyProvider getI18nProvider()
-
setI18nProvider
Unit setI18nProvider(I18nKeyProvider i18nProvider)
-
getUserInterfaceType
UserInterfaceType getUserInterfaceType()
-
setUserInterfaceType
Unit setUserInterfaceType(UserInterfaceType userInterfaceType)
-
getConnectorType
final ConnectorType getConnectorType()
-
setConnectorType
final Unit setConnectorType(ConnectorType connectorType)
-
getConnectorData
ConnectorData getConnectorData()
-
setConnectorData
Unit setConnectorData(ConnectorData connectorData)
-
getTranslator
final TranslatorEngine getTranslator()
-
getApplicationId
String getApplicationId()
-
getBotId
PlayerId getBotId()
-
getUserId
PlayerId getUserId()
-
getUserPreferences
UserPreferences getUserPreferences()
-
getUserLocale
Locale getUserLocale()
-
getSourceConnectorType
ConnectorType getSourceConnectorType()
-
setSourceConnectorType
Unit setSourceConnectorType(ConnectorType sourceConnectorType)
-
getTargetConnectorType
ConnectorType getTargetConnectorType()
-
setTargetConnectorType
Unit setTargetConnectorType(ConnectorType targetConnectorType)
-
getUnderlyingConnector
Connector getUnderlyingConnector()
-
getEntities
Map<String, EntityStateValue> getEntities()
-
getIntent
IntentAware getIntent()
-
getNextUserActionState
NextUserActionState getNextUserActionState()
-
setNextUserActionState
Unit setNextUserActionState(NextUserActionState nextUserActionState)
-
getContext
final BotBusMockContext getContext()
-
getAction
Action getAction()
-
isCompatibleWith
Boolean isCompatibleWith(ConnectorType connectorType)
-
run
final BotBusMock run()
Run the StoryHandler of the current story.
-
checkEndCalled
final BotBusMock checkEndCalled()
Throws an exception if the end() is not called
-
addActionEntity
final BotBusMock addActionEntity(EntityValue contextValue)
Add an entity set in the current action.
-
addActionEntity
final BotBusMock addActionEntity(Entity entity, Value newValue)
Add an entity set in the current action.
-
addActionEntity
final BotBusMock addActionEntity(Entity entity, String textContent)
Simulate an action entity.
-
sendAction
Unit sendAction(Action action, Long delay)
-
getBusContextValue
<T extends Any> T getBusContextValue(String name)
Returns the non persistent current value.
-
setBusContextValue
Unit setBusContextValue(String key, Object value)
Update the non persistent current value.
-
createBotSentence
final SendSentence createBotSentence(CharSequence plainText)
-
sendRawText
BotBus sendRawText(CharSequence plainText, Long delay)
-
sendDebugData
BotBus sendDebugData(String title, Object data)
-
withPriority
BotBus withPriority(ActionPriority priority)
-
withNotificationType
BotBus withNotificationType(ActionNotificationType notificationType)
-
withVisibility
BotBus withVisibility(ActionVisibility visibility)
-
withMessage
BotBus withMessage(ConnectorType connectorType, Function0<ConnectorMessage> messageProvider)
-
withMessage
BotBus withMessage(ConnectorType connectorType, String connectorId, Function0<ConnectorMessage> messageProvider)
-
reloadProfile
Unit reloadProfile()
-
translate
TranslatedSequence translate(I18nLabelValue key)
-
markAsUnknown
Unit markAsUnknown()
-
applyBotAnswerInterceptor
final Action applyBotAnswerInterceptor(Action a)
Update Action using BotAnswerInterceptor
-
-
-
-