PaymentMethodDatabaseAdapter implements DatabaseAdapter<PaymentMethod> { @NonNull @Override public PaymentMethod read(@NonNull Cursor cursor) { final int idIndex = cursor.getColumnIndex(PaymentMethodsTable.COLUMN_ID); final int uuidIndex = cursor.getColumnIndex(PaymentMethodsTable.COLUMN_UUID); final int methodIndex = cursor.getColumnIndex(PaymentMethodsTable.COLUMN_METHOD); final int customOrderIdIndex = cursor.getColumnIndex(PaymentMethodsTable.COLUMN_CUSTOM_ORDER_ID); final int reimbursableIndex = cursor.getColumnIndex(PaymentMethodsTable.COLUMN_REIMBURSABLE); final int id = cursor.getInt(idIndex); final UUID uuid = UUID.fromString(cursor.getString(uuidIndex)); final String method = cursor.getString(methodIndex); final SyncState syncState = mSyncStateAdapter.read(cursor); final long customOrderId = cursor.getLong(customOrderIdIndex); final boolean reimbursable = cursor.getInt(reimbursableIndex) > 0; return new PaymentMethodBuilderFactory() .setId(id) .setUuid(uuid) .setMethod(method) .setSyncState(syncState) .setCustomOrderId(customOrderId) .setReimbursable(reimbursable) .build(); } PaymentMethodDatabaseAdapter();  PaymentMethodDatabaseAdapter(@NonNull SyncStateAdapter syncStateAdapter); @NonNull @Override PaymentMethod read(@NonNull Cursor cursor); @NonNull @Override ContentValues write(@NonNull PaymentMethod paymentMethod, @NonNull DatabaseOperationMetadata databaseOperationMetadata); @NonNull @Override PaymentMethod build(@NonNull PaymentMethod paymentMethod, int primaryKey,
                               @NonNull UUID uuid, @NonNull DatabaseOperationMetadata databaseOperationMetadata);  }
@Test public void read() throws Exception { final PaymentMethod paymentMethod = new PaymentMethodBuilderFactory() .setId(ID) .setUuid(PM_UUID) .setMethod(METHOD) .setSyncState(mSyncState) .setCustomOrderId(CUSTOM_ORDER) .build(); assertEquals(paymentMethod, mPaymentMethodDatabaseAdapter.read(mCursor)); }