HaloModule implements Parcelable { @Api(1.0) @NonNull public ContentValues getContentValues() { ContentValues values = new ContentValues(); values.put(HaloManagerContract.RemoteModules.CUSTOMER, mCustomerId); values.put(HaloManagerContract.RemoteModules.ID, mId); values.put(HaloManagerContract.RemoteModules.INTERNAL_ID, mInternalId); values.put(HaloManagerContract.RemoteModules.NAME, mName); values.put(HaloManagerContract.RemoteModules.ENABLED, mEnabled); values.put(HaloManagerContract.RemoteModules.SINGLE, mIsSingle); values.put(HaloManagerContract.RemoteModules.UPDATED_AT, mLastUpdate != null ? mLastUpdate.getTime() : null); values.put(HaloManagerContract.RemoteModules.CREATED_AT, mCreationDate != null ? mCreationDate.getTime() : null); return values; } HaloModule(); @Api(1.2)  HaloModule(@NonNull Integer customerId, @NonNull String id, @NonNull String name, boolean enabled, @NonNull Date creationDate, @Nullable Date lastUpdate, @NonNull String internalId, boolean isSingle, JSONArray fields); protected  HaloModule(Parcel in); @Api(1.0) @NonNull static HaloModule create(@NonNull Cursor cursor); @Api(1.0) @NonNull static List<HaloModule> fromCursor(@Nullable Cursor cursor, boolean close); @Api(1.0) @NonNull ContentValues getContentValues(); @Api(1.0) @NonNull Integer getCustomerId(); @Api(1.0) @NonNull String getId(); @Api(1.0) @NonNull String getName(); @Api(1.0) @NonNull Boolean isEnabled(); @Api(1.0) @Nullable Date getLastUpdate(); @Api(1.0) @NonNull Date getCreationDate(); @Api(1.0) String getInternalId(); @Api(2.3) JSONArray getFields(); @Api(1.0) boolean isSingleItemInstance(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); @Override String toString(); static final Creator<HaloModule> CREATOR; }
@Test public void thatContentValuesAreOk() { ContentValues values = mModule.getContentValues(); assertThat(values.getAsInteger(RemoteModules.ID)).isEqualTo(Integer.valueOf(1)); assertThat(values.getAsInteger(RemoteModules.CUSTOMER)).isEqualTo(Integer.valueOf(1)); assertThat(values.getAsString(RemoteModules.NAME)).isEqualTo("myModule"); assertThat(values.getAsBoolean(RemoteModules.ENABLED)).isEqualTo(true); assertThat(values.getAsLong(RemoteModules.CREATED_AT)).isEqualTo(Long.valueOf(mCreatedAt.getTime())); assertThat(values.getAsLong(RemoteModules.UPDATED_AT)).isEqualTo(Long.valueOf(mUpdatedAt.getTime())); assertThat(values.getAsString(RemoteModules.INTERNAL_ID)).isEqualTo("internalId"); assertThat(values.getAsBoolean(RemoteModules.SINGLE)).isEqualTo(false); }