HaloModule implements Parcelable { @Api(1.0) @NonNull public static HaloModule create(@NonNull Cursor cursor) { HaloModule remoteModule = new HaloModule(); remoteModule.mCustomerId = cursor.getInt(cursor.getColumnIndex(HaloManagerContract.RemoteModules.CUSTOMER)); remoteModule.mId = cursor.getString(cursor.getColumnIndex(HaloManagerContract.RemoteModules.ID)); remoteModule.mName = cursor.getString(cursor.getColumnIndex(HaloManagerContract.RemoteModules.NAME)); remoteModule.mEnabled = cursor.getLong(cursor.getColumnIndex(HaloManagerContract.RemoteModules.ENABLED)) == 1; remoteModule.mIsSingle = cursor.getLong(cursor.getColumnIndex(HaloManagerContract.RemoteModules.SINGLE)) == 1; if (!cursor.isNull(cursor.getColumnIndex(HaloManagerContract.RemoteModules.UPDATED_AT))) { remoteModule.mLastUpdate = new Date(cursor.getLong(cursor.getColumnIndex(HaloManagerContract.RemoteModules.UPDATED_AT))); } if (!cursor.isNull(cursor.getColumnIndex(HaloManagerContract.RemoteModules.CREATED_AT))) { remoteModule.mCreationDate = new Date(cursor.getLong(cursor.getColumnIndex(HaloManagerContract.RemoteModules.CREATED_AT))); } remoteModule.mInternalId = cursor.getString(cursor.getColumnIndex(HaloManagerContract.RemoteModules.INTERNAL_ID)); return remoteModule; } 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 thatCreateFromCursor() { Date createDate = new Date(); Date updateDate = new Date(); HaloModule module = HaloModule.create(createCursor(0, createDate, updateDate)); assertCursorModule(module, createDate, updateDate); }