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 |
Map<String, KeyedAppState>
|
getKeyedAppStatesByKey()
Get a map of the latest |
int
|
getNumberOfUploads()
Get the number of times |
List<KeyedAppState>
|
getOnDeviceKeyedAppStates()
Get a list of |
Map<String, KeyedAppState>
|
getOnDeviceKeyedAppStatesByKey()
Get a map of the latest |
List<KeyedAppState>
|
getUploadedKeyedAppStates()
Get a list of |
Map<String, KeyedAppState>
|
getUploadedKeyedAppStatesByKey()
Get a list of the latest |
void
|
setStates(Collection<KeyedAppState> states, KeyedAppStatesCallback callback)
Record the states set. |
void
|
setStates(Collection<KeyedAppState> states)
This method is deprecated.
see |
void
|
setStatesImmediate(Collection<KeyedAppState> states)
This method is deprecated.
See |
void
|
setStatesImmediate(Collection<KeyedAppState> states, KeyedAppStatesCallback callback)
Record the set states and immediately mark all states as having been uploaded. |
Inherited methods | |
---|---|
Public constructors
FakeKeyedAppStatesReporter
public FakeKeyedAppStatesReporter ()
Public methods
getKeyedAppStates
public 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.
Returns | |
---|---|
List<KeyedAppState> |
getKeyedAppStatesByKey
public Map<String, KeyedAppState> getKeyedAppStatesByKey ()
Get a map of the latest KeyedAppState
set for each key.
Returns | |
---|---|
Map<String, KeyedAppState> |
getNumberOfUploads
public int getNumberOfUploads ()
Get the number of times setStatesImmediate(Collection)
has been called.
Returns | |
---|---|
int |
getOnDeviceKeyedAppStates
public 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(Collection)
) instances will no longer be
returned by this method.
Returns | |
---|---|
List<KeyedAppState> |
getOnDeviceKeyedAppStatesByKey
public Map<String, KeyedAppState> getOnDeviceKeyedAppStatesByKey ()
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.
Returns | |
---|---|
Map<String, KeyedAppState> |
getUploadedKeyedAppStates
public 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(Collection)
or if setStatesImmediate(Collection)
has
been called since they were set.
Returns | |
---|---|
List<KeyedAppState> |
getUploadedKeyedAppStatesByKey
public 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(Collection)
or if setStatesImmediate(Collection)
has
been called since they were set.
Returns | |
---|---|
Map<String, KeyedAppState> |
setStates
public void setStates (Collection<KeyedAppState> states, KeyedAppStatesCallback callback)
Record the states set.
Does not enforce any limit on total size of states collection.
Parameters | |
---|---|
states |
Collection |
callback |
KeyedAppStatesCallback |
setStates
public void setStates (Collection<KeyedAppState> states)
This method is deprecated.
see setStates(Collection, KeyedAppStatesCallback)
.
Parameters | |
---|---|
states |
Collection |
setStatesImmediate
public void setStatesImmediate (Collection<KeyedAppState> states)
This method is deprecated.
See setStatesImmediate(Collection, KeyedAppStatesCallback)
.
Parameters | |
---|---|
states |
Collection |
setStatesImmediate
public void setStatesImmediate (Collection<KeyedAppState> states, 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.
Parameters | |
---|---|
states |
Collection |
callback |
KeyedAppStatesCallback |