Android 12 Developer Preview is here! Try it out, and give us your feedback!

MessageTemplateController

public class MessageTemplateController
extends Object

java.lang.Object
   ↳ com.google.android.libraries.car.app.testing.model.MessageTemplateController


A controller that allows testing of an MessageTemplate.

This controller allows retrieving the following fields:

Summary

Public methods

MessageTemplate get()

Retrieves the MessageTemplate that this controller is controlling.

List<ActionController> getActions()

Returns a list of ActionControllers that contain the Actions added in the MessageTemplate being controlled.

String getDebugMessage()

Retrieves the debug message that will be shown in the desktop head unit.

ActionController getHeaderAction()

Retrieves a ActionController for the header Action that is being controlled, or null if none is present.

String getMessage()

Retrieves the message set in the MessageTemplate that is being controlled.

String getTitle()

Retrieves the title of the template.

static MessageTemplateController of(MessageTemplate messageTemplate)

Creates a MessageTemplateController to control a MessageTemplate for testing.

Inherited methods

Public methods

get

public MessageTemplate get ()

Retrieves the MessageTemplate that this controller is controlling.

Returns
MessageTemplate

getActions

public List<ActionController> getActions ()

Returns a list of ActionControllers that contain the Actions added in the MessageTemplate being controlled.

Returns
List<ActionController>

getDebugMessage

public String getDebugMessage ()

Retrieves the debug message that will be shown in the desktop head unit.

This value is the concatenation of the debug message and cause exception set in the MessageTemplate that is being controlled.

Returns
String

getHeaderAction

public ActionController getHeaderAction ()

Retrieves a ActionController for the header Action that is being controlled, or null if none is present.

Returns
ActionController

getMessage

public String getMessage ()

Retrieves the message set in the MessageTemplate that is being controlled.

The value returned is the CharSequence.toString() for the message provided.

Returns
String

getTitle

public String getTitle ()

Retrieves the title of the template.

The value returned is the CharSequence.toString() for the title provided.

Returns
String

of

public static MessageTemplateController of (MessageTemplate messageTemplate)

Creates a MessageTemplateController to control a MessageTemplate for testing.

Parameters
messageTemplate MessageTemplate

Returns
MessageTemplateController