@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 = mReceiptDatabaseAdapter.write(mReceipt, new DatabaseOperationMetadata(OperationFamilyType.Sync));
    // Note: Full page is backwards in the database
    assertEquals(RECEIPT_FILE.getName(), contentValues.getAsString(ReceiptsTable.COLUMN_PATH));
    assertEquals(NAME, contentValues.getAsString(ReceiptsTable.COLUMN_NAME));
    assertTrue(PARENT_TRIP_ID == contentValues.getAsInteger(ReceiptsTable.COLUMN_PARENT_TRIP_ID));
    assertEquals(CATEGORY_ID, (int) contentValues.getAsInteger(ReceiptsTable.COLUMN_CATEGORY_ID));
    assertEquals(PRICE, contentValues.getAsDouble(ReceiptsTable.COLUMN_PRICE), 0.0001d);
    assertEquals(TAX, contentValues.getAsDouble(ReceiptsTable.COLUMN_TAX), 0.0001d);
    assertEquals(TAX2, contentValues.getAsDouble(ReceiptsTable.COLUMN_TAX2), 0.0001d);
    assertEquals(EXCHANGE_RATE_FOR_USD, contentValues.getAsDouble(ReceiptsTable.COLUMN_EXCHANGE_RATE), 0.0001d);
    assertEquals(DATE, (long) contentValues.getAsLong(ReceiptsTable.COLUMN_DATE));
    assertEquals(TIMEZONE, contentValues.getAsString(ReceiptsTable.COLUMN_TIMEZONE));
    assertEquals(COMMENT, contentValues.getAsString(ReceiptsTable.COLUMN_COMMENT));
    assertEquals(REIMBURSABLE, contentValues.getAsBoolean(ReceiptsTable.COLUMN_REIMBURSABLE));
    assertEquals(CURRENCY_CODE, contentValues.getAsString(ReceiptsTable.COLUMN_ISO4217));
    assertEquals(PAYMENT_METHOD_ID, (int) contentValues.getAsInteger(ReceiptsTable.COLUMN_PAYMENT_METHOD_ID));
    assertEquals(!FULL_PAGE, contentValues.getAsBoolean(ReceiptsTable.COLUMN_NOTFULLPAGEIMAGE));
    assertEquals(NAME_HIDDEN_FROM_AUTO_COMPLETE, contentValues.getAsBoolean(ReceiptsTable.COLUMN_NAME_HIDDEN_AUTO_COMPLETE));
    assertEquals(COMMENT_HIDDEN_FROM_AUTO_COMPLETE, contentValues.getAsBoolean(ReceiptsTable.COLUMN_COMMENT_HIDDEN_AUTO_COMPLETE));
    assertEquals(EXTRA1, contentValues.getAsString(ReceiptsTable.COLUMN_EXTRA_EDITTEXT_1));
    assertEquals(EXTRA2, contentValues.getAsString(ReceiptsTable.COLUMN_EXTRA_EDITTEXT_2));
    assertEquals(EXTRA3, contentValues.getAsString(ReceiptsTable.COLUMN_EXTRA_EDITTEXT_3));
    assertEquals(CUSTOM_ORDER_ID, (long) contentValues.getAsLong(ReceiptsTable.COLUMN_CUSTOM_ORDER_ID));
    assertEquals(RECEIPT_UUID.toString(), contentValues.getAsString(ReceiptsTable.COLUMN_UUID));
    assertEquals(sync, contentValues.getAsString(sync));
    assertFalse(contentValues.containsKey(ReceiptsTable.COLUMN_ID));
}