BaseRx { protected final <T extends Result> void setupFitnessPendingResult(PendingResult<T> pendingResult, ResultCallback<T> resultCallback) { if(timeoutTime != null && timeoutUnit != null) { pendingResult.setResultCallback(resultCallback, timeoutTime, timeoutUnit); } else { pendingResult.setResultCallback(resultCallback); } } protected  BaseRx(@NonNull RxFit rxFit, Long timeout, TimeUnit timeUnit); protected  BaseRx(@NonNull Context ctx, @NonNull Api<? extends Api.ApiOptions.NotRequiredOptions>[] services, Scope[] scopes);   }
@Test public void setupFitnessPendingResult_NoTimeout() { BaseRx<Object> baseRx = spy(new BaseRx<Object>(rxFit, null, null) { @Override protected void handleResolutionResult(int resultCode, ConnectionResult connectionResult) {} }); ResultCallback resultCallback = Mockito.mock(ResultCallback.class); baseRx.setupFitnessPendingResult(pendingResult, resultCallback); verify(pendingResult).setResultCallback(resultCallback); }
@Test public void setupFitnessPendingResult_Timeout() { BaseRx<Object> baseRx = spy(new BaseRx<Object>(rxFit, TIMEOUT_TIME, TIMEOUT_TIMEUNIT) { @Override protected void handleResolutionResult(int resultCode, ConnectionResult connectionResult) {} }); ResultCallback resultCallback = Mockito.mock(ResultCallback.class); baseRx.setupFitnessPendingResult(pendingResult, resultCallback); verify(pendingResult).setResultCallback(resultCallback, TIMEOUT_TIME, TIMEOUT_TIMEUNIT); }