@Test
  @SuppressWarnings("unchecked")
  public void shouldReturnAllJobsOfTypeAsHtml() {
    JobInfo firstJob = newJobInfo("42", "SOME_TYPE", systemDefaultZone(), "localhost");
    when(jobService.findJobs(Optional.of("SOME_TYPE"), 100)).thenReturn(asList(firstJob));

    ModelAndView modelAndView =
        jobsController.getJobsAsHtml("SOME_TYPE", 100, mock(HttpServletRequest.class));
    List<JobRepresentation> jobs = (List<JobRepresentation>) modelAndView.getModel().get("jobs");
    assertThat(jobs, is(asList(representationOf(firstJob, false, ""))));
  }
  @Test
  public void shouldReturnAllJobs() throws IOException {
    // given
    JobInfo firstJob =
        newJobInfo("42", "TEST", fixed(ofEpochMilli(0), systemDefault()), "localhost");
    JobInfo secondJob =
        newJobInfo("42", "TEST", fixed(ofEpochMilli(1), systemDefault()), "localhost");
    when(jobService.findJobs(Optional.<String>empty(), 100))
        .thenReturn(asList(firstJob, secondJob));

    // when
    Object job = jobsController.getJobsAsJson(null, 100, mock(HttpServletRequest.class));

    // then
    assertThat(
        job,
        is(asList(representationOf(firstJob, false, ""), representationOf(secondJob, false, ""))));
  }