CategoryDatabaseAdapter implements DatabaseAdapter<Category> { @Override @NonNull public Category build(@NonNull Category category, int primaryKey, @NonNull UUID uuid, @NonNull DatabaseOperationMetadata databaseOperationMetadata) { return new CategoryBuilderFactory() .setId(primaryKey) .setUuid(uuid) .setName(category.getName()) .setCode(category.getCode()) .setSyncState(mSyncStateAdapter.get(category.getSyncState(), databaseOperationMetadata)) .setCustomOrderId(category.getCustomOrderId()) .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 build() throws Exception { final Category category = new CategoryBuilderFactory() .setId(PRIMARY_KEY_INT) .setUuid(CAT_UUID) .setName(NAME) .setCode(CODE) .setSyncState(mGetSyncState) .setCustomOrderId(CUSTOM_ORDER_ID) .build(); assertEquals(category, mCategoryDatabaseAdapter.build(mCategory, PRIMARY_KEY_INT, CAT_UUID, mock(DatabaseOperationMetadata.class))); assertEquals(category.getSyncState(), mCategoryDatabaseAdapter.build(mCategory, PRIMARY_KEY_INT, CAT_UUID, mock(DatabaseOperationMetadata.class)).getSyncState()); }