DatabaseBackupListener extends StubTableEventsListener<ModelType> { @Override public void onUpdateSuccess(@NonNull ModelType oldT, @NonNull ModelType newT, @NonNull DatabaseOperationMetadata databaseOperationMetadata) { if (databaseOperationMetadata.getOperationFamilyType() != OperationFamilyType.Sync) { mDriveDatabaseManager.syncDatabase(); } } DatabaseBackupListener(@NonNull DriveDatabaseManager driveDatabaseManager); @Override void onInsertSuccess(@NonNull ModelType modelType, @NonNull DatabaseOperationMetadata databaseOperationMetadata); @Override void onUpdateSuccess(@NonNull ModelType oldT, @NonNull ModelType newT, @NonNull DatabaseOperationMetadata databaseOperationMetadata); @Override void onDeleteSuccess(@NonNull ModelType modelType, @NonNull DatabaseOperationMetadata databaseOperationMetadata);  }
@Test public void onUpdateSuccess() { mListener.onUpdateSuccess(new Object(), new Object(), new DatabaseOperationMetadata()); verify(mDriveDatabaseManager).syncDatabase(); }
@Test public void onSyncUpdateSuccess() { mListener.onUpdateSuccess(new Object(), new Object(), new DatabaseOperationMetadata(OperationFamilyType.Sync)); verify(mDriveDatabaseManager, never()).syncDatabase(); }