PaymentMethodDatabaseAdapter implements DatabaseAdapter<PaymentMethod> { @NonNull @Override public PaymentMethod build(@NonNull PaymentMethod paymentMethod, int primaryKey, @NonNull UUID uuid, @NonNull DatabaseOperationMetadata databaseOperationMetadata) { return new PaymentMethodBuilderFactory() .setId(primaryKey) .setUuid(uuid) .setMethod(paymentMethod.getMethod()) .setSyncState(mSyncStateAdapter.get(paymentMethod.getSyncState(), databaseOperationMetadata)) .setCustomOrderId(paymentMethod.getCustomOrderId()) .setReimbursable(paymentMethod.isReimbursable()) .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 build() throws Exception { final PaymentMethod paymentMethod = new PaymentMethodBuilderFactory() .setId(ID) .setUuid(PM_UUID) .setMethod(METHOD) .setSyncState(mGetSyncState) .setCustomOrderId(CUSTOM_ORDER) .build(); final PaymentMethod actual = mPaymentMethodDatabaseAdapter.build(mPaymentMethod, ID, PM_UUID, mock(DatabaseOperationMetadata.class)); assertEquals(paymentMethod, actual); }