SyncStateAdapter { @NonNull public ContentValues writeUnsynced(@NonNull SyncState syncState) { return write(syncState, true); } @Inject  SyncStateAdapter(); @NonNull SyncState read(@NonNull Cursor cursor); @NonNull ContentValues writeUnsynced(@NonNull SyncState syncState); @NonNull ContentValues write(@NonNull SyncState syncState); @NonNull ContentValues write(@NonNull SyncState syncState, boolean isUnsynced); @NonNull ContentValues deleteSyncData(@NonNull SyncProvider syncProvider); @NonNull SyncState get(@NonNull SyncState syncState, @NonNull DatabaseOperationMetadata databaseOperationMetadata);  }
@Test public void writeUnsynced() throws Exception { final ContentValues contentValues = mSyncStateAdapter.writeUnsynced(mSyncState); assertEquals(IDENTIFIER_STRING, contentValues.getAsString("drive_sync_id")); assertFalse(contentValues.getAsBoolean("drive_is_synced")); assertEquals(DRIVE_IS_MARKED, contentValues.getAsBoolean("drive_marked_for_deletion")); assertEquals(LAST_LOCAL_MODIFICATION_TIME, (long) contentValues.getAsLong("last_local_modification_time")); }
@Test public void writeUnsyncedWithNullId() throws Exception { when(mSyncState.getSyncId(SyncProvider.GoogleDrive)).thenReturn(null); final ContentValues contentValues = mSyncStateAdapter.writeUnsynced(mSyncState); assertNull(contentValues.getAsString("drive_sync_id")); assertFalse(contentValues.getAsBoolean("drive_is_synced")); assertEquals(DRIVE_IS_MARKED, contentValues.getAsBoolean("drive_marked_for_deletion")); assertEquals(LAST_LOCAL_MODIFICATION_TIME, (long) contentValues.getAsLong("last_local_modification_time")); }