DistanceDatabaseAdapter implements SelectionBackedDatabaseAdapter<Distance, Trip> { @NonNull @Override public Distance build(@NonNull Distance distance, int primaryKey, @NonNull UUID uuid, @NonNull DatabaseOperationMetadata databaseOperationMetadata) { return new DistanceBuilderFactory(primaryKey, distance) .setUuid(uuid) .setSyncState(mSyncStateAdapter.get(distance.getSyncState(), databaseOperationMetadata)) .build(); } DistanceDatabaseAdapter(@NonNull Table<Trip> tripsTable, @NonNull Table<PaymentMethod> paymentMethodTable);  DistanceDatabaseAdapter(@NonNull Table<Trip> tripsTable, @NonNull Table<PaymentMethod> paymentMethodTable,
                                   @NonNull SyncStateAdapter syncStateAdapter); @NonNull @Override Distance read(@NonNull Cursor cursor); @NonNull @Override Distance readForSelection(@NonNull Cursor cursor, @NonNull Trip trip, boolean isDescending); @NonNull @Override ContentValues write(@NonNull Distance distance, @NonNull DatabaseOperationMetadata databaseOperationMetadata); @NonNull @Override Distance build(@NonNull Distance distance, int primaryKey, @NonNull UUID uuid,
                          @NonNull DatabaseOperationMetadata databaseOperationMetadata);  }
@Test public void build() throws Exception { final Distance distance = new DistanceBuilderFactory(ID) .setUuid(DIST_UUID) .setTrip(mTrip) .setLocation(LOCATION) .setDistance(DISTANCE) .setDate(DATE) .setTimezone(TIMEZONE) .setRate(RATE) .setCurrency(CURRENCY_CODE) .setComment(COMMENT) .setSyncState(mGetSyncState) .setPaymentMethod(PAYMENT_METHOD) .setLocationHiddenFromAutoComplete(LOCATION_HIDDEN_FROM_AUTO_COMPLETE) .setCommentHiddenFromAutoComplete(COMMENT_HIDDEN_FROM_AUTO_COMPLETE) .build(); assertEquals(distance, mDistanceDatabaseAdapter.build(mDistance, ID, DIST_UUID, mock(DatabaseOperationMetadata.class))); assertEquals(distance.getSyncState(), mDistanceDatabaseAdapter.build(mDistance, ID, DIST_UUID, mock(DatabaseOperationMetadata.class)).getSyncState()); }