### Question:
TimerResource implements Resource { @POST @Path("timers/new") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Timer newTimer(Timer timer) { timer.setLink(createTimerPath(timer.getId())); return this.logic.setTimer(timer.getTimerTime()); }  @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; }### Answer:
@Test void testNewTimer() { LocalDateTime newTimerTime = LocalDateTime.of(2018, 9, 21, 21, 21); Timer newTimer = new Timer(1, newTimerTime, null, true); when(this.tLogic.setTimer(newTimerTime)).thenReturn(newTimer); Entity<Timer> entity = Entity.entity(newTimer, MediaType.APPLICATION_JSON); Response response = this.target.path("timers/new").request().post(entity); Timer timerRead = response.readEntity(Timer.class); assertThat(response, status(200)); assertThat(timerRead.getId(), is(newTimer.getId())); assertThat(timerRead.getTimerTime(), is(newTimer.getTimerTime())); assertThat(timerRead.isActive(), is(newTimer.isActive())); }