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

FakeKeyedAppStatesReporter

open class FakeKeyedAppStatesReporter : KeyedAppStatesReporter
kotlin.Any
   ↳ androidx.enterprise.feedback.KeyedAppStatesReporter
   ↳ androidx.enterprise.feedback.FakeKeyedAppStatesReporter

A fake KeyedAppStatesReporter for testing.

Example usage:

<code>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");
  </code>

Summary

Public constructors

A fake KeyedAppStatesReporter for testing.

Public methods
open MutableList<KeyedAppState!>

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

open MutableMap<String!, KeyedAppState!>

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

open Int

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

open MutableList<KeyedAppState!>

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

open MutableMap<String!, KeyedAppState!>

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

open MutableList<KeyedAppState!>

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

open MutableMap<String!, KeyedAppState!>

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

open Unit

open Unit
setStates(@NonNull states: MutableCollection<KeyedAppState!>, @Nullable callback: KeyedAppStatesCallback?)

Record the states set.

open Unit

open Unit
setStatesImmediate(@NonNull states: MutableCollection<KeyedAppState!>, @Nullable callback: KeyedAppStatesCallback?)

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

Inherited functions

Public constructors

<init>

FakeKeyedAppStatesReporter()

A fake KeyedAppStatesReporter for testing.

Example usage:

<code>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");
  </code>

Public methods

getKeyedAppStates

@NonNull open fun getKeyedAppStates(): MutableList<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

@NonNull open fun getKeyedAppStatesByKey(): MutableMap<String!, KeyedAppState!>

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

getNumberOfUploads

open fun getNumberOfUploads(): Int

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

getOnDeviceKeyedAppStates

@NonNull open fun getOnDeviceKeyedAppStates(): MutableList<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(Collection)) instances will no longer be returned by this method.

getOnDeviceKeyedAppStatesByKey

@NonNull open fun getOnDeviceKeyedAppStatesByKey(): MutableMap<String!, KeyedAppState!>

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

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

getUploadedKeyedAppStates

@NonNull open fun getUploadedKeyedAppStates(): MutableList<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(Collection) or if setStatesImmediate(Collection) has been called since they were set.

getUploadedKeyedAppStatesByKey

@NonNull open fun getUploadedKeyedAppStatesByKey(): MutableMap<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(Collection) or if setStatesImmediate(Collection) has been called since they were set.

setStates

open fun setStates(@NonNull states: MutableCollection<KeyedAppState!>): Unit

Deprecated: see setStates(Collection, KeyedAppStatesCallback).

setStates

open fun setStates(
    @NonNull states: MutableCollection<KeyedAppState!>,
    @Nullable callback: KeyedAppStatesCallback?
): Unit

Record the states set.

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

setStatesImmediate

open fun setStatesImmediate(@NonNull states: MutableCollection<KeyedAppState!>): Unit

Deprecated: See setStatesImmediate(Collection, KeyedAppStatesCallback).

setStatesImmediate

open fun setStatesImmediate(
    @NonNull states: MutableCollection<KeyedAppState!>,
    @Nullable 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.