@Test
public void write() throws Exception {

    final String sync = "sync";
    final ContentValues syncValues = new ContentValues();
    syncValues.put(sync, sync);
    when(mSyncStateAdapter.write(mSyncState)).thenReturn(syncValues);
    final ContentValues contentValues = mDistanceDatabaseAdapter.write(mDistance, new DatabaseOperationMetadata(OperationFamilyType.Sync));
    assertTrue(PARENT_ID == contentValues.getAsInteger(DistanceTable.COLUMN_PARENT_TRIP_ID));
    assertEquals(DISTANCE, contentValues.getAsDouble(DistanceTable.COLUMN_DISTANCE), 0.0001d);
    assertEquals(LOCATION, contentValues.getAsString(DistanceTable.COLUMN_LOCATION));
    assertEquals(DATE, (long) contentValues.getAsLong(DistanceTable.COLUMN_DATE));
    assertEquals(TIMEZONE, contentValues.getAsString(DistanceTable.COLUMN_TIMEZONE));
    assertEquals(COMMENT, contentValues.getAsString(DistanceTable.COLUMN_COMMENT));
    assertEquals(RATE, contentValues.getAsDouble(DistanceTable.COLUMN_RATE), 0.0001d);
    assertEquals(CURRENCY_CODE, contentValues.getAsString(DistanceTable.COLUMN_RATE_CURRENCY));
    assertEquals(DIST_UUID.toString(), contentValues.getAsString(DistanceTable.COLUMN_UUID));
    assertEquals(sync, contentValues.getAsString(sync));
    assertEquals(PAYMENT_METHOD_ID, (int) contentValues.getAsInteger(DistanceTable.COLUMN_PAYMENT_METHOD_ID));
    assertEquals(LOCATION_HIDDEN_FROM_AUTO_COMPLETE, contentValues.getAsBoolean(DistanceTable.COLUMN_LOCATION_HIDDEN_AUTO_COMPLETE));
    assertEquals(COMMENT_HIDDEN_FROM_AUTO_COMPLETE, contentValues.getAsBoolean(DistanceTable.COLUMN_COMMENT_HIDDEN_AUTO_COMPLETE));
    assertFalse(contentValues.containsKey(DistanceTable.COLUMN_ID));
}