FakeKeyedAppStatesReporter


class FakeKeyedAppStatesReporter : KeyedAppStatesReporter


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

Public functions

(Mutable)List<KeyedAppState!>

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

(Mutable)Map<String!, KeyedAppState!>

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

Int

Get the number of times setStatesImmediate has been called.

(Mutable)List<KeyedAppState!>

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

(Mutable)Map<String!, KeyedAppState!>

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

(Mutable)List<KeyedAppState!>

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

(Mutable)Map<String!, KeyedAppState!>

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

Unit

This function is deprecated.

see setStates.

Unit
setStates(
    states: (Mutable)Collection<KeyedAppState!>,
    callback: KeyedAppStatesCallback?
)

Record the states set.

Unit

This function is deprecated.

See setStatesImmediate.

Unit

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

Inherited functions

From androidx.enterprise.feedback.KeyedAppStatesReporter
java-static KeyedAppStatesReporter
create(context: Context)

Create a reporter that binds to device owners, profile owners, and the Play store.

java-static KeyedAppStatesReporter
create(context: Context, executor: Executor)

Create a reporter using the specified executor.

Public constructors

FakeKeyedAppStatesReporter

Added in 1.0.0
FakeKeyedAppStatesReporter()

Public functions

getKeyedAppStates

Added in 1.0.0
fun getKeyedAppStates(): (Mutable)List<KeyedAppState!>

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

This is in the order that they were set, and may contain multiple with the same key, if that key has been set twice.

getKeyedAppStatesByKey

Added in 1.0.0
fun getKeyedAppStatesByKey(): (Mutable)Map<String!, KeyedAppState!>

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

getNumberOfUploads

Added in 1.0.0
fun getNumberOfUploads(): Int

Get the number of times setStatesImmediate has been called.

getOnDeviceKeyedAppStates

Added in 1.0.0
fun getOnDeviceKeyedAppStates(): (Mutable)List<KeyedAppState!>

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

This is in the order that they were set, and may contain multiple with the same key, if that key has been set twice.

Once uploaded (using setStatesImmediate) instances will no longer be returned by this method.

getOnDeviceKeyedAppStatesByKey

Added in 1.0.0
fun getOnDeviceKeyedAppStatesByKey(): (Mutable)Map<String!, KeyedAppState!>

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

Once uploaded (using setStatesImmediate) instances will no longer be returned by this method.

getUploadedKeyedAppStates

Added in 1.0.0
fun getUploadedKeyedAppStates(): (Mutable)List<KeyedAppState!>

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

This is in the order that they were set, and may contain multiple with the same key, if that key has been set twice.

States will be returned by this method if they were set using setStatesImmediate or if setStatesImmediate has been called since they were set.

getUploadedKeyedAppStatesByKey

Added in 1.0.0
fun getUploadedKeyedAppStatesByKey(): (Mutable)Map<String!, KeyedAppState!>

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

This is in the order that they were set, and may contain multiple with the same key, if that key has been set twice.

States will be returned by this method if they were set using setStatesImmediate or if setStatesImmediate has been called since they were set.

setStates

Added in 1.0.0
Deprecated in 1.1.0-rc01
fun setStates(states: (Mutable)Collection<KeyedAppState!>): Unit

setStates

fun setStates(
    states: (Mutable)Collection<KeyedAppState!>,
    callback: KeyedAppStatesCallback?
): Unit

Record the states set.

Does not enforce any limit on total size of states collection.

setStatesImmediate

Added in 1.0.0
Deprecated in 1.1.0-rc01
fun setStatesImmediate(states: (Mutable)Collection<KeyedAppState!>): Unit

setStatesImmediate

fun setStatesImmediate(
    states: (Mutable)Collection<KeyedAppState!>,
    callback: KeyedAppStatesCallback?
): Unit

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

Does not enforce any quota on uploading, or limit on total size of states collection.