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 |
|---|
Public methods |
|
|---|---|
@NonNull List<KeyedAppState> |
Get a list of all |
@NonNull Map<String, KeyedAppState> |
Get a map of the latest |
int |
Get the number of times |
@NonNull List<KeyedAppState> |
Get a list of |
@NonNull Map<String, KeyedAppState> |
Get a map of the latest |
@NonNull List<KeyedAppState> |
Get a list of |
@NonNull Map<String, KeyedAppState> |
Get a list of the latest |
void |
This method is deprecated. see |
void |
setStates(Record the states set. |
void |
This method is deprecated. See |
void |
setStatesImmediate(Record the set states and immediately mark all states as having been uploaded. |
Inherited methods |
||||
|---|---|---|---|---|
|
Public constructors
Public methods
getKeyedAppStates
public @NonNull List<KeyedAppState> getKeyedAppStates()
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
public @NonNull Map<String, KeyedAppState> getKeyedAppStatesByKey()
Get a map of the latest KeyedAppState set for each key.
getNumberOfUploads
public int getNumberOfUploads()
Get the number of times setStatesImmediate has been called.
getOnDeviceKeyedAppStates
public @NonNull List<KeyedAppState> getOnDeviceKeyedAppStates()
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
public @NonNull Map<String, KeyedAppState> getOnDeviceKeyedAppStatesByKey()
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
public @NonNull List<KeyedAppState> getUploadedKeyedAppStates()
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
public @NonNull Map<String, KeyedAppState> getUploadedKeyedAppStatesByKey()
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
public voidsetStates(@NonNull Collection<KeyedAppState> states)
setStates
public void setStates(
@NonNull Collection<KeyedAppState> states,
@Nullable KeyedAppStatesCallback callback
)
Record the states set.
Does not enforce any limit on total size of states collection.
setStatesImmediate
public voidsetStatesImmediate(@NonNull Collection<KeyedAppState> states)
setStatesImmediate
public void setStatesImmediate(
@NonNull Collection<KeyedAppState> states,
@Nullable KeyedAppStatesCallback callback
)
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.