title: Mockito when method not working [MockitoHint] 1. Unused
body: <p>I have this test class:</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)  
  public class JobServiceTests {
  
  @InjectMocks
  private ServiceImpl subject;
  
  @Mock
  private ApplicationContext applicationContext;
  
  @Mock
  private JobLauncher jobLauncher;
  
  @Mock
  private JobExplorer jobExplorer;
  
  
  
  @Test
  public void test() throws Exception {
      final SimpleJob simpleJob = new SimpleJob();
      simpleJob.setName("nameJob");
  
      when(applicationContext.getBean(any(String.class), any(Job.class))).thenReturn(simpleJob);
  
      final JobParameters jobLauncherParam = ImtJobParameters.builder()
              .addParameter("p1", "v1", true)
              .build();
  
      final BatchJobExec jobExec = subject.launchBatchJob("nameJob", jobLauncherParam);
      assertThat(jobExec.id).isEqualTo(100L);
  
  
      final JobParametersBuilder jobParametersBuilder = new JobParametersBuilder();
      jobParametersBuilder.addString("param1", "val1", true);
      final JobParameters jobParams = jobParametersBuilder.toJobParameters();
  
      verify(applicationContext, only()).getBean(eq("myJob"), eq(simpleJob));
  
  }
  </code></pre>
  
  <p>When run the test obtain <code>NullPointerException</code> because <code>jobExec</code> is null and </p>
  
  <p>[MockitoHint] 1. Unused... -> at ...</p>
  
  <p>[MockitoHint]  ...args ok? -> at ...
   but i don't understand why <code>when(applicationContext.getBean(any(String.class), any(Job.class))).thenReturn(simpleJob);</code> not working ... </p>
  
  <p>The method <code>launchBatchJob</code>:</p>
  
  <pre><code>  public BatchJobExec launchBatchJob(final String jobName, final JobLaunchParameters jobLaunchPayload) {
      Job job;
      try {
          job = applicationContext.getBean(jobName, Job.class);
      } catch (final BeansException e) {
          throw new BatchJobNotFoundException(String.format("Batch Job  with name %s not found", jobName), e);
      }
  
      JobExecution jobExecution;
      try {
          jobExecution = jobLauncher.run(job, createJobParameters(jobLaunchPayload.getParameters()));
      } catch (//
              JobExecutionAlreadyRunningException //
              | JobRestartException //
              | JobInstanceAlreadyCompleteException //
              | JobParametersInvalidException e) {
          LOG.error(String.format("Failed to launch job %s", jobName), e);
          throw new BatchJobLaunchException(//
                  String.format("Failed to launch job %s", jobName), //
                  e);
      }
  
      return jobExecutionMapper.mapJobExecutionToImtBatchJobExec(jobExecution);
  }
  </code></pre>