Google is committed to advancing racial equity for Black communities. See how.

ActionController

public class ActionController
extends Object

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


A controller that allows testing of an Action.

This controller allows:

  • Performing a click on the Action as if the user did.
  • Retrieving the Action's title.
  • Retrieving the Action's background color.

Summary

Public methods

Action get()

Retrieves the Action that this controller is controlling.

CarColor getBackgroundColor()

Retrieves the color set via Action.Builder.setBackgroundColor(CarColor), or CarColor.DEFAULT if no background color is set.

String getTitle()

Retrieves the title set via Action.Builder.setTitle(CharSequence), or null if no title is present.

static ActionController of(Action action)

Creates an ActionController to control an Action for testing.

void performClick()

Performs a click on the Action controlled by this controller.

Inherited methods

Public methods

get

public Action get ()

Retrieves the Action that this controller is controlling.

Returns
Action

getBackgroundColor

public CarColor getBackgroundColor ()

Retrieves the color set via Action.Builder.setBackgroundColor(CarColor), or CarColor.DEFAULT if no background color is set.

Returns
CarColor

getTitle

public String getTitle ()

Retrieves the title set via Action.Builder.setTitle(CharSequence), or null if no title is present.

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

Returns
String

of

public static ActionController of (Action action)

Creates an ActionController to control an Action for testing.

Parameters
action Action

Returns
ActionController

performClick

public void performClick ()

Performs a click on the Action controlled by this controller.