When I unit test @parcel annotated models, I get the same object (even when using Bundle
, or Intent
):
@Test public void parcel() {
MyObject myObject = new MyObject("123");
Parcelable parcelable = Parcels.wrap(myObject);
MyObject in = Parcels.unwrap(parcelable);
// myObject == in (same id)
}
How to simulate the situation where the model is passed from one activity to the other, hence being recreated?
update: might need to use this.