diff options
author | cyBerta <cyberta@riseup.net> | 2024-01-25 23:55:52 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2024-01-25 23:55:52 +0100 |
commit | 6f7b3bbf255b0be4d5ff1bd994aad0d61b8cca8d (patch) | |
tree | 8ef413c9187285b6adade91f744948436c3c4258 /app/src/test/java/android/content/Intent.java | |
parent | 9bba7b29a416b2617af033a778ef13a512024502 (diff) |
fix ProviderApiManagerTest, sneaking in some missing changes from previous commits as well
Diffstat (limited to 'app/src/test/java/android/content/Intent.java')
-rw-r--r-- | app/src/test/java/android/content/Intent.java | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/app/src/test/java/android/content/Intent.java b/app/src/test/java/android/content/Intent.java new file mode 100644 index 00000000..92211558 --- /dev/null +++ b/app/src/test/java/android/content/Intent.java @@ -0,0 +1,61 @@ +package android.content; + +import android.os.Bundle; +import android.os.Parcelable; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class Intent { + final String[] action = new String[1]; + final Map<String, Object> fakeExtras = new HashMap<>(); + final List<String> categories = new ArrayList<>(); + + public Intent setAction(String action) { + this.action[0] = action; + return this; + } + + public String getAction() { + return action[0]; + } + + public Intent putExtra(String key, Bundle bundle) { + fakeExtras.put(key, bundle); + return this; + } + + public Bundle getBundleExtra(String key) { + Object o = fakeExtras.get(key); + if (o != null) { + return (Bundle) o; + } + return null; + } + + public Intent putExtra(String key, Parcelable extra) { + fakeExtras.put(key, extra); + return this; + } + + public Parcelable getParcelableExtra(String key) { + Object o = fakeExtras.get(key); + if (o != null) { + return (Parcelable) o; + } + return null; + } + + public Intent addCategory(String key) { + categories.add(key); + return this; + } + + public Set<String> getCategories() { + return new HashSet<>(categories); + } +} |