@Test public void getWhenSyncing() throws Exception { assertEquals(mSyncState, mSyncStateAdapter.get(mSyncState, new DatabaseOperationMetadata(OperationFamilyType.Sync))); }
@NonNull public SyncState get(@NonNull SyncState syncState, @NonNull DatabaseOperationMetadata databaseOperationMetadata) { if (databaseOperationMetadata.getOperationFamilyType() == OperationFamilyType.Sync) { return syncState; } else { final Identifier driveIdentifier = syncState.getSyncId(SyncProvider.GoogleDrive); final IdentifierMap identifierMap; if (driveIdentifier != null) { identifierMap = new IdentifierMap(Collections.singletonMap(SyncProvider.GoogleDrive, driveIdentifier)); } else { identifierMap = null; } final SyncStatusMap syncStatusMap = new SyncStatusMap(Collections.singletonMap(SyncProvider.GoogleDrive, false)); final MarkedForDeletionMap markedForDeletionMap = new MarkedForDeletionMap(Collections.singletonMap(SyncProvider.GoogleDrive, syncState.isMarkedForDeletion(SyncProvider.GoogleDrive))); return new DefaultSyncState(identifierMap, syncStatusMap, markedForDeletionMap, syncState.getLastLocalModificationTime()); } }
SyncStateAdapter { @NonNull public SyncState get(@NonNull SyncState syncState, @NonNull DatabaseOperationMetadata databaseOperationMetadata) { if (databaseOperationMetadata.getOperationFamilyType() == OperationFamilyType.Sync) { return syncState; } else { final Identifier driveIdentifier = syncState.getSyncId(SyncProvider.GoogleDrive); final IdentifierMap identifierMap; if (driveIdentifier != null) { identifierMap = new IdentifierMap(Collections.singletonMap(SyncProvider.GoogleDrive, driveIdentifier)); } else { identifierMap = null; } final SyncStatusMap syncStatusMap = new SyncStatusMap(Collections.singletonMap(SyncProvider.GoogleDrive, false)); final MarkedForDeletionMap markedForDeletionMap = new MarkedForDeletionMap(Collections.singletonMap(SyncProvider.GoogleDrive, syncState.isMarkedForDeletion(SyncProvider.GoogleDrive))); return new DefaultSyncState(identifierMap, syncStatusMap, markedForDeletionMap, syncState.getLastLocalModificationTime()); } } }
SyncStateAdapter { @NonNull public SyncState get(@NonNull SyncState syncState, @NonNull DatabaseOperationMetadata databaseOperationMetadata) { if (databaseOperationMetadata.getOperationFamilyType() == OperationFamilyType.Sync) { return syncState; } else { final Identifier driveIdentifier = syncState.getSyncId(SyncProvider.GoogleDrive); final IdentifierMap identifierMap; if (driveIdentifier != null) { identifierMap = new IdentifierMap(Collections.singletonMap(SyncProvider.GoogleDrive, driveIdentifier)); } else { identifierMap = null; } final SyncStatusMap syncStatusMap = new SyncStatusMap(Collections.singletonMap(SyncProvider.GoogleDrive, false)); final MarkedForDeletionMap markedForDeletionMap = new MarkedForDeletionMap(Collections.singletonMap(SyncProvider.GoogleDrive, syncState.isMarkedForDeletion(SyncProvider.GoogleDrive))); return new DefaultSyncState(identifierMap, syncStatusMap, markedForDeletionMap, syncState.getLastLocalModificationTime()); } } @Inject  SyncStateAdapter(); }
SyncStateAdapter { @NonNull public SyncState get(@NonNull SyncState syncState, @NonNull DatabaseOperationMetadata databaseOperationMetadata) { if (databaseOperationMetadata.getOperationFamilyType() == OperationFamilyType.Sync) { return syncState; } else { final Identifier driveIdentifier = syncState.getSyncId(SyncProvider.GoogleDrive); final IdentifierMap identifierMap; if (driveIdentifier != null) { identifierMap = new IdentifierMap(Collections.singletonMap(SyncProvider.GoogleDrive, driveIdentifier)); } else { identifierMap = null; } final SyncStatusMap syncStatusMap = new SyncStatusMap(Collections.singletonMap(SyncProvider.GoogleDrive, false)); final MarkedForDeletionMap markedForDeletionMap = new MarkedForDeletionMap(Collections.singletonMap(SyncProvider.GoogleDrive, syncState.isMarkedForDeletion(SyncProvider.GoogleDrive))); return new DefaultSyncState(identifierMap, syncStatusMap, markedForDeletionMap, syncState.getLastLocalModificationTime()); } } @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); }
SyncStateAdapter { @NonNull public SyncState get(@NonNull SyncState syncState, @NonNull DatabaseOperationMetadata databaseOperationMetadata) { if (databaseOperationMetadata.getOperationFamilyType() == OperationFamilyType.Sync) { return syncState; } else { final Identifier driveIdentifier = syncState.getSyncId(SyncProvider.GoogleDrive); final IdentifierMap identifierMap; if (driveIdentifier != null) { identifierMap = new IdentifierMap(Collections.singletonMap(SyncProvider.GoogleDrive, driveIdentifier)); } else { identifierMap = null; } final SyncStatusMap syncStatusMap = new SyncStatusMap(Collections.singletonMap(SyncProvider.GoogleDrive, false)); final MarkedForDeletionMap markedForDeletionMap = new MarkedForDeletionMap(Collections.singletonMap(SyncProvider.GoogleDrive, syncState.isMarkedForDeletion(SyncProvider.GoogleDrive))); return new DefaultSyncState(identifierMap, syncStatusMap, markedForDeletionMap, syncState.getLastLocalModificationTime()); } } @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);  }