Cron { @GET @Produces(MediaType.APPLICATION_JSON) public Response dumpContents() { ImmutableMap.Builder<String, String> scheduled = ImmutableMap.builder(); for (Map.Entry<IJobKey, CrontabEntry> entry : cronManager.getScheduledJobs().entrySet()) { scheduled.put(JobKeys.canonicalString(entry.getKey()), entry.getValue().toString()); } return Response.ok(ImmutableMap.of("scheduled", scheduled.build())).build(); } @Inject  Cron(CronJobManager cronManager); @GET @Produces(MediaType.APPLICATION_JSON) Response dumpContents();  }
@Test public void testDumpContents() throws Exception { expect(cronJobManager.getScheduledJobs()).andReturn(ImmutableMap.of( JobKeys.from("test", "test", "test"), CrontabEntry.parse("* * * * *"))); control.replay(); Response response = cron.dumpContents(); assertEquals(HttpServletResponse.SC_OK, response.getStatus()); assertEquals( "{\"scheduled\":{\"test/test/test\":\"* * * * *\"}}", OBJECT_MAPPER.writeValueAsString(response.getEntity())); }