androidx.annotation.VisibleForTesting Java Examples

The following examples show how to use androidx.annotation.VisibleForTesting. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: aptoide-client-v8   Author: Aptoide   File: HomeContainerPresenter.java    License: GNU General Public License v3.0 6 votes vote down vote up
@VisibleForTesting public void handlePromotionsClick() {
  view.getLifecycleEvent()
      .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE))
      .flatMap(created -> view.toolbarPromotionsClick()
          .observeOn(viewScheduler)
          .doOnNext(account -> {
            homeAnalytics.sendPromotionsIconClickEvent();
            homeNavigator.navigateToPromotions();
          })
          .retry())
      .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY))
      .subscribe(__ -> {
      }, throwable -> {
        throw new OnErrorNotImplementedException(throwable);
      });
}
 
Example #2
Source Project: aptoide-client-v8   Author: Aptoide   File: HomeContainerPresenter.java    License: GNU General Public License v3.0 6 votes vote down vote up
@VisibleForTesting public void handleLoggedInAcceptTermsAndConditions() {
  view.getLifecycleEvent()
      .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE))
      .flatMap(__ -> accountManager.accountStatus()
          .first())
      .filter(Account::isLoggedIn)
      .filter(
          account -> !(account.acceptedPrivacyPolicy() && account.acceptedTermsAndConditions()))
      .observeOn(viewScheduler)
      .doOnNext(__ -> view.showTermsAndConditionsDialog())
      .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY))
      .subscribe(__ -> {
      }, throwable -> {
        throw new OnErrorNotImplementedException(throwable);
      });
}
 
Example #3
Source Project: aptoide-client-v8   Author: Aptoide   File: HomeContainerPresenter.java    License: GNU General Public License v3.0 6 votes vote down vote up
@VisibleForTesting public void handleClickOnPromotionsDialogContinue() {
  view.getLifecycleEvent()
      .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE))
      .flatMap(__ -> view.promotionsHomeDialogClicked())
      .filter(action -> action.equals("navigate"))
      .doOnNext(__ -> {
        homeAnalytics.sendPromotionsDialogNavigateEvent();
        view.dismissPromotionsDialog();
        homeNavigator.navigateToPromotions();
      })
      .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY))
      .subscribe(__ -> {
      }, throwable -> {
        throw new OnErrorNotImplementedException(throwable);
      });
}
 
Example #4
Source Project: science-journal   Author: google   File: ChartData.java    License: Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
boolean tryAddingLabel(Label label) {
  long timestamp = label.getTimeStamp();
  if (data.isEmpty() || timestamp < getXMin() || timestamp > getXMax()) {
    return false;
  }
  int indexPrev = exactBinarySearch(timestamp, 0);
  DataPoint start = data.get(indexPrev);
  if (timestamp == start.getX()) {
    labels.add(start);
    return true;
  } else if (indexPrev < data.size() - 2) {
    DataPoint end = data.get(indexPrev + 1);
    double weight = (timestamp - start.getX()) / (1.0 * end.getX() - start.getX());
    labels.add(new DataPoint(timestamp, start.getY() * weight + end.getY() * (1 - weight)));
    return true;
  }
  return false;
}
 
Example #5
Source Project: litho   Author: facebook   File: Section.java    License: Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
public String generateUniqueGlobalKeyForChild(Section section, String childKey) {
  final KeyHandler keyHandler = mScopedContext.getKeyHandler();

  /** If the key is already unique, return it. */
  if (!keyHandler.hasKey(childKey)) {
    return childKey;
  }

  final String childType = section.getSimpleName();

  if (mChildCounters == null) {
    mChildCounters = new HashMap<>();
  }

  /**
   * If the key is a duplicate, we start appending an index based on the child component's type
   * that would uniquely identify it.
   */
  final int childIndex =
      mChildCounters.containsKey(childType) ? mChildCounters.get(childType) : 0;
  mChildCounters.put(childType, childIndex + 1);

  return childKey + childIndex;
}
 
Example #6
Source Project: science-journal   Author: google   File: ChartController.java    License: Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
public ChartController(
    ChartOptions.ChartPlacementType chartPlacementType,
    ScalarDisplayOptions scalarDisplayOptions,
    int chartDataThrowawayThreshold,
    long dataLoadBuffer,
    Clock uptimeClock,
    FailureListener dataFailureListener) {
  this.uptimeClock = uptimeClock;
  chartData =
      new ChartData(chartDataThrowawayThreshold, ChartData.DEFAULT_THROWAWAY_TIME_THRESHOLD);
  chartOptions = new ChartOptions(chartPlacementType);
  chartOptions.setScalarDisplayOptions(scalarDisplayOptions);
  this.dataFailureListener = dataFailureListener;
  defaultGraphRange = ExternalAxisController.DEFAULT_GRAPH_RANGE_IN_MILLIS;
  this.dataLoadBuffer = dataLoadBuffer;
  currentTimeClock = new CurrentTimeClock();
}
 
Example #7
Source Project: bitgatt   Author: Fitbit   File: FitbitGatt.java    License: Mozilla Public License 2.0 6 votes vote down vote up
@VisibleForTesting
void connectToScannedDevice(FitbitBluetoothDevice fitDevice, boolean shouldMock, GattTransactionCallback callback) {
    GattConnection conn = connectionMap.get(fitDevice);
    if (conn == null) {
        if (appContext == null) {
            Timber.w("[%s] Bitgatt client must not be started, please start bitgatt client", fitDevice);
            return;
        }
        conn = new GattConnection(fitDevice, appContext.getMainLooper());
        connectionMap.put(fitDevice, conn);
        notifyListenersOfConnectionAdded(conn);
    }
    conn.setMockMode(shouldMock);
    if (!conn.isConnected()) {
        GattConnectTransaction tx = new GattConnectTransaction(conn, GattState.CONNECTED);
        conn.runTx(tx, callback);
    } else {
        TransactionResult.Builder builder = new TransactionResult.Builder();
        builder.resultStatus(TransactionResult.TransactionResultStatus.SUCCESS)
            .gattState(conn.getGattState());
        callback.onTransactionComplete(builder.build());
    }
}
 
Example #8
Source Project: aptoide-client-v8   Author: Aptoide   File: HomePresenter.java    License: GNU General Public License v3.0 6 votes vote down vote up
@VisibleForTesting public void handleKnowMoreClick() {
  view.getLifecycleEvent()
      .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE))
      .flatMap(created -> view.infoBundleKnowMoreClicked())
      .observeOn(viewScheduler)
      .doOnNext(homeEvent -> {
        homeAnalytics.sendActionItemTapOnCardInteractEvent(homeEvent.getBundle()
            .getTag(), homeEvent.getBundlePosition());
        homeNavigator.navigateToAppCoinsInformationView();
      })
      .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY))
      .subscribe(lifecycleEvent -> {
      }, throwable -> {
        throw new OnErrorNotImplementedException(throwable);
      });
}
 
Example #9
Source Project: aptoide-client-v8   Author: Aptoide   File: HomeContainerPresenter.java    License: GNU General Public License v3.0 6 votes vote down vote up
@VisibleForTesting public void loadMainHomeContent() {
  view.getLifecycleEvent()
      .filter(event -> event.equals(View.LifecycleEvent.CREATE))
      .flatMap(__ -> view.isChipChecked())
      .doOnNext(checked -> {
        switch (checked) {
          case GAMES:
            homeContainerNavigator.loadGamesHomeContent();
            break;
          case APPS:
            homeContainerNavigator.loadAppsHomeContent();
            break;
          default:
            homeContainerNavigator.loadMainHomeContent();
            break;
        }
      })
      .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY))
      .subscribe(__ -> {
      }, err -> {
        throw new OnErrorNotImplementedException(err);
      });
}
 
Example #10
Source Project: science-journal   Author: google   File: SimpleMetaDataManager.java    License: Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
@Deprecated
void updateProject(Project project) {
  synchronized (lock) {
    final SQLiteDatabase db = dbHelper.getWritableDatabase();
    final ContentValues values = new ContentValues();
    values.put(ProjectColumns.TITLE, project.getTitle());
    values.put(ProjectColumns.DESCRIPTION, project.getDescription());
    values.put(ProjectColumns.COVER_PHOTO, project.getCoverPhoto());
    values.put(ProjectColumns.ARCHIVED, project.isArchived());
    values.put(ProjectColumns.LAST_USED_TIME, project.getLastUsedTime());
    db.update(
        Tables.PROJECTS,
        values,
        ProjectColumns.PROJECT_ID + "=?",
        new String[] {project.getProjectId()});
  }
}
 
Example #11
Source Project: science-journal   Author: google   File: TimestampPickerController.java    License: Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
public TimestampPickerController(
    Locale locale,
    boolean isStartCrop,
    String negativePrefix,
    String hourMinuteDivider,
    String minuteSecondDivider,
    OnTimestampErrorListener errorListener) {
  this.locale = locale;
  this.isStartCrop = isStartCrop;
  this.errorListener = errorListener;
  this.negativePrefix = negativePrefix;
  // Builds the formatter, which will be used to read and write timestamp strings.
  periodFormatter =
      new PeriodFormatterBuilder()
          .rejectSignedValues(true) // Applies to all fields
          .printZeroAlways() // Applies to all fields
          .appendHours()
          .appendLiteral(hourMinuteDivider)
          .minimumPrintedDigits(2) // Applies to minutes and seconds
          .appendMinutes()
          .appendLiteral(minuteSecondDivider)
          .appendSecondsWithMillis()
          .toFormatter()
          .withLocale(this.locale);
}
 
Example #12
Source Project: android-test   Author: android   File: AndroidTestOrchestrator.java    License: Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
static String addTestCoverageSupport(Bundle args, String filename) {
  // Only do the aggregate coverage mode if coverage was requested AND we're running in isolation
  // mode.
  // If not running in isolation, the AJUR coverage mechanism of dumping coverage data to a
  // single file is sufficient since all test run in the same invocation.
  if (shouldRunCoverage(args) && runsInIsolatedMode(args)) {
    checkState(
        args.getString(AJUR_COVERAGE_FILE) == null,
        "Can't use a custom coverage file name [-e %s %s] when running through "
            + "orchestrator in isolated mode, since the generated coverage files will "
            + "overwrite each other. Please consider using [%s] instead.",
        AJUR_COVERAGE_FILE,
        args.getString(AJUR_COVERAGE_FILE),
        COVERAGE_FILE_PATH);

    String path = args.getString(COVERAGE_FILE_PATH);
    return path + filename + ".ec";
  }
  return null;
}
 
Example #13
Source Project: aptoide-client-v8   Author: Aptoide   File: HomeContainerPresenter.java    License: GNU General Public License v3.0 6 votes vote down vote up
@VisibleForTesting public void loadUserImage() {
  view.getLifecycleEvent()
      .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE))
      .flatMap(created -> accountManager.accountStatus())
      .flatMap(account -> getUserAvatar(account))
      .observeOn(viewScheduler)
      .doOnNext(userAvatarUrl -> {
        if (userAvatarUrl != null) {
          view.setUserImage(userAvatarUrl);
        } else {
          view.setDefaultUserImage();
        }
        view.showAvatar();
      })
      .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY))
      .subscribe(__ -> {
      }, throwable -> {
        throw new OnErrorNotImplementedException(throwable);
      });
}
 
Example #14
Source Project: firebase-android-sdk   Author: firebase   File: FirebaseDynamicLinksImpl.java    License: Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
public FirebaseDynamicLinksImpl(
    GoogleApi<NoOptions> googleApi, @Nullable AnalyticsConnector analytics) {
  this.googleApi = googleApi;
  this.analytics = analytics;

  if (analytics == null) {
    // b/34217790: Try to get an instance of Analytics. This initializes Google Analytics
    // if it is set up for the app, which sets up the association for the app and package name,
    // allowing GmsCore to log FDL events on behalf of the app.

    // AppMeasurement was not found. This probably means that the app did not include
    // the FirebaseAnalytics dependency.
    Log.w(
        TAG,
        "FDL logging failed. Add a dependency for Firebase Analytics"
            + " to your app to enable logging of Dynamic Link events.");
  }
}
 
Example #15
Source Project: talkback   Author: google   File: TalkBackKeyboardShortcutPreferencesActivity.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
void resetKeymap() {
  TalkBackKeyboardShortcutPreferenceFragment fragment =
      (TalkBackKeyboardShortcutPreferenceFragment)
          getFragmentManager().findFragmentById(android.R.id.content);
  fragment.resetKeymap();
}
 
Example #16
Source Project: aptoide-client-v8   Author: Aptoide   File: MyAccountPresenter.java    License: GNU General Public License v3.0 5 votes vote down vote up
@VisibleForTesting public void handleProfileEditClick() {
  view.getLifecycleEvent()
      .filter(event -> event.equals(View.LifecycleEvent.CREATE))
      .flatMap(viewCreated -> view.editUserProfileClick()
          .flatMap(click -> accountManager.accountStatus()
              .first())
          .doOnNext(account -> myAccountNavigator.navigateToEditProfileView()))
      .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY))
      .subscribe(account -> {
      }, throwable -> crashReport.log(throwable));
}
 
Example #17
Source Project: aptoide-client-v8   Author: Aptoide   File: EditorialListPresenter.java    License: GNU General Public License v3.0 5 votes vote down vote up
@VisibleForTesting public void handleReactionButtonClick() {
  view.getLifecycleEvent()
      .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE))
      .flatMap(created -> view.reactionsButtonClicked())
      .observeOn(viewScheduler)
      .flatMap(this::handleSinglePressReactionButton)
      .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY))
      .subscribe(lifecycleEvent -> {
      }, crashReporter::log);
}
 
Example #18
Source Project: xipl   Author: zaclimon   File: EpgSyncJobService.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
public static Intent createSyncStartedIntent(String inputId) {
    Intent intent = new Intent(ACTION_SYNC_STATUS_CHANGED);
    intent.putExtra(BUNDLE_KEY_INPUT_ID, inputId);
    intent.putExtra(SYNC_STATUS, SYNC_STARTED);
    return intent;
}
 
Example #19
Source Project: ETSMobile-Android2   Author: ApplETS   File: MoodleViewModel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Filter courses by removing the courses with no assignment
 *
 * @param assignmentCourses
 * @return filtered courses
 */
@VisibleForTesting
List<MoodleAssignmentCourse> filterAssignmentCourses(List<MoodleAssignmentCourse> assignmentCourses) {
    List<MoodleAssignmentCourse> filteredCourses = new ArrayList<>();

    for (MoodleAssignmentCourse course : assignmentCourses) {

        int nbAssignments = course.getAssignments().size();

        if (nbAssignments != 0) {
            /*
             Si les devoirs antérieurs ne doivent pas être affichés, ceux-ci ne doivent pas être
             pris en compte.
             */
            if (!isDisplayPastAssignments()) {
                for (MoodleAssignment assignment : course.getAssignments()) {
                    Date dueDate = assignment.getDueDateObj();
                    Date currentDate = new Date();
                    if (dueDate.before(currentDate))
                        nbAssignments--;
                }
            }

            // Ajout du cours si celui-ci contient des devoirs
            if (nbAssignments != 0)
                filteredCourses.add(course);
        }
    }

    return filteredCourses;
}
 
Example #20
Source Project: talkback   Author: google   File: ParseTreeResourceNode.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates CharSequence from template string by its parameters. The template string will be
 * transformed to contain "^1"-style placeholder values dynamically to match the format of
 * {@link TextUtils#expandTemplate(CharSequence, CharSequence...)} and formatted by other
 * none-string type parameters.
 *
 * @param templateString template string that may contains parameters with strings.
 * @param parameters object arrays that are supposed but not necessary to be string. If it is
 *     string, the corresponding placeholder value will be changed to "^1"-style. If not string
 *     type, the placeholder is kept and adjust the index.
 * @return CharSequence that composed by template string with "^1"-style placeholder values.
 */
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
protected static CharSequence toExpandableTemplate(String templateString, Object[] parameters) {
  String expandTemplateString = templateString;
  List<Object> otherTypeList = new ArrayList<>();

  int spanTypeIndex = 1;
  int otherTypeIndex = 1;
  for (int i = 1; i <= parameters.length; i++) {
    Object param = parameters[i - 1];
    if (param instanceof CharSequence) {
      // replaces string type "%1$s" or "%s" to "^1" and so on.
      if (expandTemplateString.contains("%" + i + "$s")) {
        expandTemplateString =
            expandTemplateString.replace(("%" + i + "$s"), ("^" + spanTypeIndex));
      } else if (expandTemplateString.contains("%s")) {
        expandTemplateString = expandTemplateString.replaceFirst("%s", ("^" + spanTypeIndex));
      }
      spanTypeIndex++;
    } else {
      // keeps and assigns correct index to other type parameters
      expandTemplateString = expandTemplateString.replace(("%" + i), ("%" + otherTypeIndex));
      otherTypeList.add(param);
      otherTypeIndex++;
    }
  }
  return String.format(expandTemplateString, otherTypeList.toArray());
}
 
Example #21
Source Project: aptoide-client-v8   Author: Aptoide   File: HomeContainerPresenter.java    License: GNU General Public License v3.0 5 votes vote down vote up
@VisibleForTesting public void handleTermsAndConditionsLogOutClicked() {
  view.getLifecycleEvent()
      .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE))
      .flatMap(__ -> view.gdprDialogClicked())
      .filter(action -> action.equals("logout"))
      .flatMapCompletable(__ -> accountManager.logout())
      .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY))
      .subscribe(__ -> {
      }, throwable -> {
        throw new OnErrorNotImplementedException(throwable);
      });
}
 
Example #22
Source Project: science-journal   Author: google   File: SimpleMetaDataManager.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
List<ExperimentOverviewPojo> getDatabaseExperimentOverviews(boolean includeArchived) {
  List<ExperimentOverviewPojo> experiments = new ArrayList<>();
  synchronized (lock) {
    final SQLiteDatabase db = dbHelper.getReadableDatabase();

    String selection = "";
    if (!includeArchived) {
      selection = ExperimentColumns.ARCHIVED + "=0";
    }
    Cursor cursor = null;
    try {
      cursor =
          db.query(
              Tables.EXPERIMENTS,
              ExperimentColumns.GET_COLUMNS,
              selection,
              null,
              null,
              null,
              ExperimentColumns.LAST_USED_TIME + " DESC, " + BaseColumns._ID + " DESC");
      while (cursor.moveToNext()) {
        experiments.add(createExperimentOverviewFromCursor(cursor));
      }
    } finally {
      if (cursor != null) {
        cursor.close();
      }
    }
  }
  return experiments;
}
 
Example #23
Source Project: Leanplum-Android-SDK   Author: Leanplum   File: Leanplum.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
public static Map<String, String> parseFilenameToURLs(JSONObject response) {
  JSONObject filesObject = response.optJSONObject(
          Constants.Keys.FILES);
  if (filesObject != null) {
    return JsonConverter.mapFromJson(filesObject);
  }
  return null;
}
 
Example #24
Source Project: aptoide-client-v8   Author: Aptoide   File: EditorialListPresenter.java    License: GNU General Public License v3.0 5 votes vote down vote up
@VisibleForTesting public void onCreateLoadViewModel() {
  view.getLifecycleEvent()
      .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE))
      .doOnNext(created -> view.showLoading())
      .flatMap(__ -> loadEditorialAndReactions(false, false))
      .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY))
      .subscribe(__ -> {
      }, crashReporter::log);
}
 
Example #25
Source Project: litho   Author: facebook   File: TestItem.java    License: Apache License 2.0 5 votes vote down vote up
@DoNotStrip
@VisibleForTesting
public String getTextContent() {
  final List<CharSequence> textItems = getTextItems();
  final StringBuilder sb = new StringBuilder();
  for (int i = 0, size = textItems.size(); i < size; i++) {
    sb.append(textItems.get(i));
  }

  return sb.toString();
}
 
Example #26
Source Project: edx-app-android   Author: edx   File: UserProfileFragment.java    License: Apache License 2.0 5 votes vote down vote up
@NonNull
@VisibleForTesting
public static Bundle createArguments(@NonNull String username) {
    final Bundle bundle = new Bundle();
    bundle.putString(UserProfileActivity.EXTRA_USERNAME, username);
    return bundle;
}
 
Example #27
Source Project: LiTr   Author: linkedin   File: TransformationJob.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@VisibleForTesting
void initStatsCollector() {
    // TODO modify TrackTransformationInfo to report muxing/demuxing and different media sources/targets
    for (TrackTransform trackTransform : trackTransforms) {
        statsCollector.addSourceTrack(trackTransform.getMediaSource().getTrackFormat(trackTransform.getSourceTrack()));
    }
}
 
Example #28
Source Project: aptoide-client-v8   Author: Aptoide   File: EditorialPresenter.java    License: GNU General Public License v3.0 5 votes vote down vote up
@VisibleForTesting public void handleLongPressReactionButton() {
  view.getLifecycleEvent()
      .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE))
      .flatMap(created -> view.reactionsButtonLongPressed())
      .flatMap(click -> editorialManager.loadEditorialViewModel()
          .toObservable())
      .doOnNext(editorialViewModel -> {
        editorialAnalytics.sendReactionButtonClickEvent();
        view.showReactionsPopup(editorialViewModel.getCardId(), editorialViewModel.getGroupId());
      })
      .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY))
      .subscribe(lifecycleEvent -> {
      }, crashReporter::log);
}
 
Example #29
Source Project: science-journal   Author: google   File: ExperimentCache.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
ExperimentCache(
    Context context,
    AppAccount appAccount,
    FailureListener failureListener,
    boolean enableAutoWrite) {
  this(
      context,
      appAccount,
      failureListener,
      enableAutoWrite,
      AppSingleton.getInstance(context).getExperimentLibraryManager(appAccount),
      AppSingleton.getInstance(context).getLocalSyncManager(appAccount));
}
 
Example #30
Source Project: AppAuth-Android   Author: openid   File: TokenResponse.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets the relative expiration time of the access token, in seconds, using the provided
 * clock as the source of the current time.
 */
@NonNull
@VisibleForTesting
Builder setAccessTokenExpiresIn(@Nullable Long expiresIn, @NonNull Clock clock) {
    if (expiresIn == null) {
        mAccessTokenExpirationTime = null;
    } else {
        mAccessTokenExpirationTime = clock.getCurrentTimeMillis()
                + TimeUnit.SECONDS.toMillis(expiresIn);
    }
    return this;
}