SessionController


class SessionController


SessionController provides API that allows testing of a Session.

This controller allows:

  • Injecting a TestCarContext into the Session instance, which provides access to the test managers and other testing functionalities.

Summary

Public constructors

SessionController(
    session: Session,
    context: TestCarContext,
    intent: Intent
)

Creates a SessionController to control the provided Session.

Public functions

Session

Returns the Session that is being controlled.

SessionController

Moves the Session being controlled to the input state.

Public constructors

SessionController

Added in 1.1.0
SessionController(
    session: Session,
    context: TestCarContext,
    intent: Intent
)

Creates a SessionController to control the provided Session.

Parameters
session: Session

the Session to control

context: TestCarContext

the TestCarContext that the session should use.

intent: Intent

the Intent that the session should start with during the CREATED state.

Throws
java.lang.NullPointerException

if session or context is null

Public functions

getSession

Added in 1.1.0
fun getSession(): Session

Returns the Session that is being controlled.

moveToState

Added in 1.1.0
fun moveToState(state: Lifecycle.State): SessionController

Moves the Session being controlled to the input state.

Note that DESTROYED is a terminal state, and you cannot move to any other state after the Session reaches that state.

See also
getLifecycle