@Test public void testExecuteJob_handlesNull() { executionDelegator.executeJob(null); verifyZeroInteractions(mockContext); }
void executeJob(JobInvocation jobInvocation) { if (jobInvocation == null) { return; } if (!constraintChecker.areConstraintsSatisfied(jobInvocation)) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Not executing job because constraints still unmet. Job: " + jobInvocation); } jobFinishedCallback.onJobFinished(jobInvocation, JobService.RESULT_FAIL_RETRY); return; } if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Proceeding to execute job because constraints met. Job: " + jobInvocation); } synchronized (serviceConnections) { JobServiceConnection jobServiceConnection = serviceConnections.get(jobInvocation.getService()); if (jobServiceConnection != null) { jobServiceConnection.startJob(jobInvocation); return; } jobServiceConnection = new JobServiceConnection(execCallback, context); serviceConnections.put(jobInvocation.getService(), jobServiceConnection); jobServiceConnection.startJob(jobInvocation); boolean successfullyBound = tryBindingToJobService(jobInvocation, jobServiceConnection); if (successfullyBound) { } else { Log.e(TAG, "Unable to bind to " + jobInvocation.getService()); jobServiceConnection.unbind(); } } }
ExecutionDelegator { void executeJob(JobInvocation jobInvocation) { if (jobInvocation == null) { return; } if (!constraintChecker.areConstraintsSatisfied(jobInvocation)) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Not executing job because constraints still unmet. Job: " + jobInvocation); } jobFinishedCallback.onJobFinished(jobInvocation, JobService.RESULT_FAIL_RETRY); return; } if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Proceeding to execute job because constraints met. Job: " + jobInvocation); } synchronized (serviceConnections) { JobServiceConnection jobServiceConnection = serviceConnections.get(jobInvocation.getService()); if (jobServiceConnection != null) { jobServiceConnection.startJob(jobInvocation); return; } jobServiceConnection = new JobServiceConnection(execCallback, context); serviceConnections.put(jobInvocation.getService(), jobServiceConnection); jobServiceConnection.startJob(jobInvocation); boolean successfullyBound = tryBindingToJobService(jobInvocation, jobServiceConnection); if (successfullyBound) { } else { Log.e(TAG, "Unable to bind to " + jobInvocation.getService()); jobServiceConnection.unbind(); } } } }
ExecutionDelegator { void executeJob(JobInvocation jobInvocation) { if (jobInvocation == null) { return; } if (!constraintChecker.areConstraintsSatisfied(jobInvocation)) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Not executing job because constraints still unmet. Job: " + jobInvocation); } jobFinishedCallback.onJobFinished(jobInvocation, JobService.RESULT_FAIL_RETRY); return; } if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Proceeding to execute job because constraints met. Job: " + jobInvocation); } synchronized (serviceConnections) { JobServiceConnection jobServiceConnection = serviceConnections.get(jobInvocation.getService()); if (jobServiceConnection != null) { jobServiceConnection.startJob(jobInvocation); return; } jobServiceConnection = new JobServiceConnection(execCallback, context); serviceConnections.put(jobInvocation.getService(), jobServiceConnection); jobServiceConnection.startJob(jobInvocation); boolean successfullyBound = tryBindingToJobService(jobInvocation, jobServiceConnection); if (successfullyBound) { } else { Log.e(TAG, "Unable to bind to " + jobInvocation.getService()); jobServiceConnection.unbind(); } } } ExecutionDelegator(
      Context context,
      JobFinishedCallback jobFinishedCallback,
      ConstraintChecker constraintChecker); }
ExecutionDelegator { void executeJob(JobInvocation jobInvocation) { if (jobInvocation == null) { return; } if (!constraintChecker.areConstraintsSatisfied(jobInvocation)) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Not executing job because constraints still unmet. Job: " + jobInvocation); } jobFinishedCallback.onJobFinished(jobInvocation, JobService.RESULT_FAIL_RETRY); return; } if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Proceeding to execute job because constraints met. Job: " + jobInvocation); } synchronized (serviceConnections) { JobServiceConnection jobServiceConnection = serviceConnections.get(jobInvocation.getService()); if (jobServiceConnection != null) { jobServiceConnection.startJob(jobInvocation); return; } jobServiceConnection = new JobServiceConnection(execCallback, context); serviceConnections.put(jobInvocation.getService(), jobServiceConnection); jobServiceConnection.startJob(jobInvocation); boolean successfullyBound = tryBindingToJobService(jobInvocation, jobServiceConnection); if (successfullyBound) { } else { Log.e(TAG, "Unable to bind to " + jobInvocation.getService()); jobServiceConnection.unbind(); } } } ExecutionDelegator(
      Context context,
      JobFinishedCallback jobFinishedCallback,
      ConstraintChecker constraintChecker);  }
ExecutionDelegator { void executeJob(JobInvocation jobInvocation) { if (jobInvocation == null) { return; } if (!constraintChecker.areConstraintsSatisfied(jobInvocation)) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Not executing job because constraints still unmet. Job: " + jobInvocation); } jobFinishedCallback.onJobFinished(jobInvocation, JobService.RESULT_FAIL_RETRY); return; } if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Proceeding to execute job because constraints met. Job: " + jobInvocation); } synchronized (serviceConnections) { JobServiceConnection jobServiceConnection = serviceConnections.get(jobInvocation.getService()); if (jobServiceConnection != null) { jobServiceConnection.startJob(jobInvocation); return; } jobServiceConnection = new JobServiceConnection(execCallback, context); serviceConnections.put(jobInvocation.getService(), jobServiceConnection); jobServiceConnection.startJob(jobInvocation); boolean successfullyBound = tryBindingToJobService(jobInvocation, jobServiceConnection); if (successfullyBound) { } else { Log.e(TAG, "Unable to bind to " + jobInvocation.getService()); jobServiceConnection.unbind(); } } } ExecutionDelegator(
      Context context,
      JobFinishedCallback jobFinishedCallback,
      ConstraintChecker constraintChecker);   }