tock / ai.tock.bot.test.junit / TockJUnit4Rule

TockJUnit4Rule

open class TockJUnit4Rule<out T : TestContext> (source)

A JUnit4 Rule to initialize the context for each call.

Constructors

<init>

A JUnit4 Rule to initialize the context for each call.

TockJUnit4Rule(botDefinition: BotDefinition, lifecycle: TestLifecycle<T> = TestLifecycle(TestContext() as T))

Properties

botDefinition

val botDefinition: BotDefinition

lifecycle

val lifecycle: TestLifecycle<T>

testContext

The TestContext.

val testContext: T

Functions

apply

open fun apply(base: <ERROR CLASS>, description: <ERROR CLASS>): <ERROR CLASS>

busMock

Provides a mock context initialized with the current testContext.

fun busMock(): BotBusMock

newBusMock

Provides a mock initialized with the specified StoryDefinition.

fun newBusMock(story: StoryDefinition = testContext.defaultStoryDefinition(botDefinition), connectorType: ConnectorType = testContext.defaultConnectorType(), locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId()): BotBusMock

newBusMockContext

Provides a mock context initialized with the specified StoryDefinition.

fun newBusMockContext(story: StoryDefinition = testContext.defaultStoryDefinition(botDefinition), connectorType: ConnectorType = testContext.defaultConnectorType(), locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId()): BotBusMockContext

startBusMock

Provides a mock context initialized with the current testContext and runs the bus.

fun startBusMock(): BotBusMock

startNewBusMock

Provides a mock initialized with the specified StoryDefinition and starts the story.

fun startNewBusMock(story: StoryDefinition = testContext.defaultStoryDefinition(botDefinition), connectorType: ConnectorType = testContext.defaultConnectorType(), locale: Locale = testContext.defaultLocale(), userId: PlayerId = testContext.defaultPlayerId()): BotBusMock