CategoryDatabaseAdapter implements DatabaseAdapter<Category> { @Override @NonNull public Category read(@NonNull Cursor cursor) { final int idIndex = cursor.getColumnIndex(CategoriesTable.COLUMN_ID); final int uuidIndex = cursor.getColumnIndex(CategoriesTable.COLUMN_UUID); final int nameIndex = cursor.getColumnIndex(CategoriesTable.COLUMN_NAME); final int codeIndex = cursor.getColumnIndex(CategoriesTable.COLUMN_CODE); final int customOrderIdIndex = cursor.getColumnIndex(COLUMN_CUSTOM_ORDER_ID); final int id = cursor.getInt(idIndex); final UUID uuid = UUID.fromString(cursor.getString(uuidIndex)); final String name = cursor.getString(nameIndex); final String code = cursor.getString(codeIndex); final SyncState syncState = mSyncStateAdapter.read(cursor); final long orderId = cursor.getLong(customOrderIdIndex); return new CategoryBuilderFactory() .setId(id) .setUuid(uuid) .setName(name) .setCode(code) .setSyncState(syncState) .setCustomOrderId(orderId) .build(); } CategoryDatabaseAdapter();  CategoryDatabaseAdapter(@NonNull SyncStateAdapter syncStateAdapter); @Override @NonNull Category read(@NonNull Cursor cursor); @Override @NonNull ContentValues write(@NonNull Category category, @NonNull DatabaseOperationMetadata databaseOperationMetadata); @Override @NonNull Category build(@NonNull Category category, int primaryKey, @NonNull UUID uuid,
                          @NonNull DatabaseOperationMetadata databaseOperationMetadata);  }
@Test public void read() throws Exception { final Category category = new CategoryBuilderFactory() .setId(PRIMARY_KEY_INT) .setUuid(CAT_UUID) .setName(NAME) .setCode(CODE) .setSyncState(mSyncState) .setCustomOrderId(CUSTOM_ORDER_ID) .build(); assertEquals(category, mCategoryDatabaseAdapter.read(mCursor)); }