-
- 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classBotBusMock.Companion
-
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 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 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)BotBussend(Action action, Long delay)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. 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()DialoggetDialog()DialoggetCurrentDialog()StorygetStory()BotDefinitiongetBotDefinition()I18nKeyProvidergetI18nProvider()UserInterfaceTypegetUserInterfaceType()final ConnectorTypegetConnectorType()ConnectorDatagetConnectorData()final TranslatorEnginegetTranslator()StringgetApplicationId()PlayerIdgetBotId()PlayerIdgetUserId()UserPreferencesgetUserPreferences()LocalegetUserLocale()ConnectorTypegetTargetConnectorType()ConnectorgetUnderlyingConnector()Map<String, EntityStateValue>getEntities()IntentAwaregetIntent()NextUserActionStategetNextUserActionState()final BotBusMockContextgetContext()ActiongetAction()StringgetContextId()IntentAwaregetCurrentIntent()StoryStep<out StoryHandlerDefinition>getStep()StringgetStepName()BooleangetTest()StringgetUserText()UnitsetUserTimeline(UserTimeline userTimeline)UnitsetDialog(Dialog dialog)UnitsetStory(Story story)UnitsetBotDefinition(BotDefinition botDefinition)UnitsetI18nProvider(I18nKeyProvider i18nProvider)UnitsetUserInterfaceType(UserInterfaceType userInterfaceType)final UnitsetConnectorType(ConnectorType connectorType)UnitsetConnectorData(ConnectorData connectorData)UnitsetTargetConnectorType(ConnectorType targetConnectorType)UnitsetIntent(IntentAware intent)UnitsetNextUserActionState(NextUserActionState nextUserActionState)UnitsetStep(StoryStep<out StoryHandlerDefinition> step)-
Methods inherited from class ai.tock.bot.test.BotBusMock
booleanChoice, changeContextValue, changeContextValue, changeEntityText, changeEntityValue, changeEntityValue, changeEntityValue, choice, contextValue, contextValue, defaultDelay, end, end, end, end, end, end, endRawText, entityText, entityText, entityValue, entityValue, entityValueDetails, entityValueDetails, getBusContextValue, handleAndSwitchStory, hasActionEntity, hasActionEntity, hasChoiceValue, i18n, i18nKey, isChoiceAction, isFeatureEnabled, isIntent, nlpStats, removeAllEntityValues, removeEntityValue, removeEntityValue, resetDialogState, send, send, send, send, send, send, setBusContextValue, skipAnswer, switchStory, withMessage -
Methods inherited from class ai.tock.bot.engine.Bus
translate, translate, translateAndReturnBlankAsNull -
Methods inherited from class ai.tock.translator.I18nKeyProvider
equals, hashCode, toString -
Methods inherited from class ai.tock.bot.engine.I18nTranslator
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
-
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)
-
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
-
assert
final Unit assert(ConnectorMessageProvider messages)
Assert that logs contains specified messages.
-
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()
-
getDialog
Dialog getDialog()
-
getCurrentDialog
Dialog getCurrentDialog()
-
getStory
Story getStory()
-
getBotDefinition
BotDefinition getBotDefinition()
-
getI18nProvider
I18nKeyProvider getI18nProvider()
-
getUserInterfaceType
UserInterfaceType getUserInterfaceType()
-
getConnectorType
final ConnectorType getConnectorType()
-
getConnectorData
ConnectorData getConnectorData()
-
getTranslator
final TranslatorEngine getTranslator()
-
getApplicationId
String getApplicationId()
-
getBotId
PlayerId getBotId()
-
getUserId
PlayerId getUserId()
-
getUserPreferences
UserPreferences getUserPreferences()
-
getUserLocale
Locale getUserLocale()
-
getTargetConnectorType
ConnectorType getTargetConnectorType()
-
getUnderlyingConnector
Connector getUnderlyingConnector()
-
getEntities
Map<String, EntityStateValue> getEntities()
-
getIntent
IntentAware getIntent()
-
getNextUserActionState
NextUserActionState getNextUserActionState()
-
getContext
final BotBusMockContext getContext()
-
getAction
Action getAction()
-
getContextId
String getContextId()
-
getCurrentIntent
IntentAware getCurrentIntent()
-
getStep
StoryStep<out StoryHandlerDefinition> getStep()
-
getStepName
String getStepName()
-
getUserText
String getUserText()
-
setUserTimeline
Unit setUserTimeline(UserTimeline userTimeline)
-
setBotDefinition
Unit setBotDefinition(BotDefinition botDefinition)
-
setI18nProvider
Unit setI18nProvider(I18nKeyProvider i18nProvider)
-
setUserInterfaceType
Unit setUserInterfaceType(UserInterfaceType userInterfaceType)
-
setConnectorType
final Unit setConnectorType(ConnectorType connectorType)
-
setConnectorData
Unit setConnectorData(ConnectorData connectorData)
-
setTargetConnectorType
Unit setTargetConnectorType(ConnectorType targetConnectorType)
-
setNextUserActionState
Unit setNextUserActionState(NextUserActionState nextUserActionState)
-
-
-
-