FakeKeyedAppStatesReporter

public class FakeKeyedAppStatesReporter
extends KeyedAppStatesReporter

java.lang.Object
   ↳ androidx.enterprise.feedback.KeyedAppStatesReporter
     ↳ androidx.enterprise.feedback.FakeKeyedAppStatesReporter


A fake KeyedAppStatesReporter for testing.

Example usage:

FakeKeyedAppStatesReporter reporter = new FakeKeyedAppStatesReporter();
   // Inject the reporter to the part of your code it will be used.
   assertThat(reporter.getKeyedAppStatesByKey().get("myKey").getMessage()).isEqualTo("expected");
 

Summary

Public constructors

FakeKeyedAppStatesReporter()

Public methods

List<KeyedAppState> getKeyedAppStates()

Get a list of all KeyedAppState instances that have been set.

Map<String, KeyedAppState> getKeyedAppStatesByKey()

Get a map of the latest KeyedAppState set for each key.

int getNumberOfUploads()

Get the number of times setStatesImmediate(Collection) has been called.

List<KeyedAppState> getOnDeviceKeyedAppStates()

Get a list of KeyedAppState instances that have been set but not yet uploaded.

Map<String, KeyedAppState> getOnDeviceKeyedAppStatesByKey()

Get a map of the latest KeyedAppState set for each key that has not yet uploaded.

List<KeyedAppState> getUploadedKeyedAppStates()

Get a list of KeyedAppState instances that have been set and uploaded.

Map<String, KeyedAppState> getUploadedKeyedAppStatesByKey()

Get a list of the latest KeyedAppState set for each key that has been uploaded.

void setStates(Collection<KeyedAppState> states, KeyedAppStatesCallback callback)

Record the states set.

void setStates(Collection<KeyedAppState> states)

This method is deprecated. see setStates(Collection, KeyedAppStatesCallback).

void setStatesImmediate(Collection<KeyedAppState> states)

This method is deprecated. See setStatesImmediate(Collection, KeyedAppStatesCallback).

void setStatesImmediate(Collection<KeyedAppState> states, KeyedAppStatesCallback callback)

Record the set states and immediately mark all states as having been uploaded.

Inherited methods