@RequestMapping(value = "/jobs/{jobName}", method = RequestMethod.GET)
  public String details(
      ModelMap model,
      @ModelAttribute("jobName") String jobName,
      Errors errors,
      @RequestParam(defaultValue = "0") int startJobInstance,
      @RequestParam(defaultValue = "20") int pageSize) {

    boolean launchable = jobService.isLaunchable(jobName);

    try {

      Collection<JobInstance> result =
          jobService.listJobInstances(jobName, startJobInstance, pageSize);
      Collection<JobInstanceInfo> jobInstances = new ArrayList<JobInstanceInfo>();
      model.addAttribute(
          "jobParameters",
          jobParametersExtractor.fromJobParameters(jobService.getLastJobParameters(jobName)));

      for (JobInstance jobInstance : result) {
        Collection<JobExecution> jobExecutions =
            jobService.getJobExecutionsForJobInstance(jobName, jobInstance.getId());
        jobInstances.add(new JobInstanceInfo(jobInstance, jobExecutions, timeZone));
      }

      model.addAttribute("jobInstances", jobInstances);
      int total = jobService.countJobInstances(jobName);
      TableUtils.addPagination(model, total, startJobInstance, pageSize, "JobInstance");
      int count = jobService.countJobExecutionsForJob(jobName);
      model.addAttribute(
          "jobInfo", new JobInfo(jobName, count, launchable, jobService.isIncrementable(jobName)));

    } catch (NoSuchJobException e) {
      errors.reject(
          "no.such.job",
          new Object[] {jobName},
          "There is no such job (" + HtmlUtils.htmlEscape(jobName) + ")");
    }

    return "jobs/job";
  }
  @Test
  public void testGetInstanceId() {
    when(instance.getId()).thenReturn(5L);

    assertEquals(5L, context.getInstanceId());
  }