mercredi 6 mai 2015

How to properly unit test parcelable objects?

I am wondering what the best way to unit test Android parcelable objects is. I know how I can test parcelable objects using the Parcel.obtain() and writing it to a parcel and creating it using the creator. The problem with this method is it will not catch if someone adds a field to an object without adding it to the parcelable/equals/hashcode logic. Is there a library or method that exists to confirm that all object fields are written to a parcel? I know that not all fields should be parceled, I envision an annotation or something per field to determine if should be included in the unit test.

Aucun commentaire:

Enregistrer un commentaire