diff options
author | Zhihong Xu <zhihongx@google.com> | 2013-11-26 09:28:55 -0800 |
---|---|---|
committer | Zhihong Xu <zhihongx@google.com> | 2013-11-26 09:28:55 -0800 |
commit | e684fca0cb7f9f55508d0125180ea0a51b6a206e (patch) | |
tree | 92c9267a86ac6273be01633c472989de7b1690f5 | |
parent | c442dd3f1599c6e4fc11f4d942ab3d4cd3fbb9f7 (diff) | |
download | robolectric-e684fca0cb7f9f55508d0125180ea0a51b6a206e.tar.gz |
Switch ShadowBundle to use a TreeMap in robo-v1
Many Wallet tests assert equality of Parcelables by writing them
to Parcels and comparing the Parcels. This assumes a one-to-one
mapping between Parcelables and their Parcel representations.
The assumption holds for most Parcelables we come across, but breaks
down for Bundle. The Parcel representation of Bundle depends on the
order of the items in the Bundle. Previously ShadowBundle was backed
by an unordered HashMap. The order of items in the map can be affected
by the order in which the items are inserted. This change fixes that
by switching to an ordered TreeMap.
Change-Id: I5b6c3a6c4d6120176864f091fd59b2c7e8d94a69
-rw-r--r-- | src/main/java/com/xtremelabs/robolectric/shadows/ShadowBundle.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/com/xtremelabs/robolectric/shadows/ShadowBundle.java b/src/main/java/com/xtremelabs/robolectric/shadows/ShadowBundle.java index a4d6eb2ca..02ddf898f 100644 --- a/src/main/java/com/xtremelabs/robolectric/shadows/ShadowBundle.java +++ b/src/main/java/com/xtremelabs/robolectric/shadows/ShadowBundle.java @@ -4,9 +4,9 @@ import static com.xtremelabs.robolectric.Robolectric.shadowOf_; import java.io.Serializable; import java.util.ArrayList; -import java.util.HashMap; import java.util.Map; import java.util.Set; +import java.util.TreeMap; import android.os.Build; import android.os.Bundle; @@ -19,7 +19,7 @@ import com.xtremelabs.robolectric.internal.Implements; @SuppressWarnings({ "UnusedDeclaration" }) @Implements(Bundle.class) public class ShadowBundle { - Map<String, Object> map = new HashMap<String, Object>(); + Map<String, Object> map = new TreeMap<String, Object>(); public void __constructor__(Bundle b) { putAll(b); |