@Test void testGetAllTimers() { List<Timer> returnedTimers = createTimers(3, true); when(this.tLogic.getAllTimers()).thenReturn(returnedTimers); Response response = this.target.path("timers").request().get(); assertThat(returnedTimers, hasSize(3)); assertThat(response, status(200)); }
@GET @Path("timers") @Produces(MediaType.APPLICATION_JSON) public List<Timer> getAllTimers() { List<Timer> timerList = this.logic.getAllTimers(); for (Timer t : timerList) { t.setLink(createTimerPath(t.getId())); } return this.logic.getAllTimers(); }
TimerResource implements Resource { @GET @Path("timers") @Produces(MediaType.APPLICATION_JSON) public List<Timer> getAllTimers() { List<Timer> timerList = this.logic.getAllTimers(); for (Timer t : timerList) { t.setLink(createTimerPath(t.getId())); } return this.logic.getAllTimers(); } }
TimerResource implements Resource { @GET @Path("timers") @Produces(MediaType.APPLICATION_JSON) public List<Timer> getAllTimers() { List<Timer> timerList = this.logic.getAllTimers(); for (Timer t : timerList) { t.setLink(createTimerPath(t.getId())); } return this.logic.getAllTimers(); }  }
TimerResource implements Resource { @GET @Path("timers") @Produces(MediaType.APPLICATION_JSON) public List<Timer> getAllTimers() { List<Timer> timerList = this.logic.getAllTimers(); for (Timer t : timerList) { t.setLink(createTimerPath(t.getId())); } return this.logic.getAllTimers(); }  @GET @Path("timers") @Produces(MediaType.APPLICATION_JSON) List<Timer> getAllTimers(); @GET @Path("timers/{pathid}") @Produces(MediaType.APPLICATION_JSON) Timer getTimer(@PathParam("pathid") int timerNumber); @POST @Path("timers/new") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Timer newTimer(Timer timer); @POST @Path("timers/deleteAll") void deleteAllTimers(); @POST @Path("timers/delete/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Timer deleteTimer(@PathParam("pathid") int timerNumber); @POST @Path("timers/de.activate/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Timer activatedeactivateAlarm(@PathParam("pathid") int timerNumber, Timer timerInc); @Override ResourceEntity getPluginDescripion(); }
TimerResource implements Resource { @GET @Path("timers") @Produces(MediaType.APPLICATION_JSON) public List<Timer> getAllTimers() { List<Timer> timerList = this.logic.getAllTimers(); for (Timer t : timerList) { t.setLink(createTimerPath(t.getId())); } return this.logic.getAllTimers(); }  @GET @Path("timers") @Produces(MediaType.APPLICATION_JSON) List<Timer> getAllTimers(); @GET @Path("timers/{pathid}") @Produces(MediaType.APPLICATION_JSON) Timer getTimer(@PathParam("pathid") int timerNumber); @POST @Path("timers/new") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Timer newTimer(Timer timer); @POST @Path("timers/deleteAll") void deleteAllTimers(); @POST @Path("timers/delete/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Timer deleteTimer(@PathParam("pathid") int timerNumber); @POST @Path("timers/de.activate/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Timer activatedeactivateAlarm(@PathParam("pathid") int timerNumber, Timer timerInc); @Override ResourceEntity getPluginDescripion(); static final String PATH; }