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

ToggleController

public class ToggleController
extends Object

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


A controller that allows testing of a Toggle.

This controller allows:

  • Performing a click on the toggle as if the user did.
  • Retrieving the toggle's selected state.

Summary

Public methods

Toggle get()

Retrieves the Toggle that this controller is controlling.

boolean isChecked()

Retrieves the checked state of the Toggle controlled by this controller.

static ToggleController of(Toggle toggle)

Creates a ToggleController to control a Toggle for testing.

void performClick()

Performs a click on the Toggle controlled by this controller.

Inherited methods

Public methods

get

public Toggle get ()

Retrieves the Toggle that this controller is controlling.

Returns
Toggle

isChecked

public boolean isChecked ()

Retrieves the checked state of the Toggle controlled by this controller.

Returns
boolean

of

public static ToggleController of (Toggle toggle)

Creates a ToggleController to control a Toggle for testing.

Parameters
toggle Toggle

Returns
ToggleController

performClick

public void performClick ()

Performs a click on the Toggle controlled by this controller.