### Question:
TimerLogic implements RunnableService { public Timer reactivateTimer(Timer timer) { if (!timer.isActive()) { timer.setActive(true); LocalDateTime current = LocalDateTime.now(); int timertime = (int) (timer.duration().toMillis() / 1000); LocalDateTime newTimerTime = current.plusSeconds(timertime); timer.setTimerTime(newTimerTime); this.timerStorage.save(timer); Runnable timerRunnable = createTimerRunnable(timer); ZonedDateTime ringtime = this.environment.getCurrentDateTime().with(timer.getTimerTime()); this.taskScheduler.schedule(timerRunnable, ringtime.toInstant()); return timer; } throw new IllegalArgumentException("Timer is already active"); }  Runnable createTimerRunnable(Timer timer); Timer setTimer(LocalDateTime timerTime); int searchTimerId(); String deleteAllTimers(); String deleteTimer(int timerNumber); String stopRinging(); Timer getTimer(int timerNumber); List<Timer> getAllTimers(); Timer pauseTimer(Timer timer); Timer reactivateTimer(Timer timer); @Override void start(); @Override void stop();  }### Answer:
@Test protected void testReactivateTimer() { List<Timer> returnedTimers = createTimers(3, true); when(this.timerStorage.getAll()).thenReturn(returnedTimers); when(this.env.getCurrentDateTime()).thenReturn(ZonedDateTime.of(2018, 2, 1, 4, 21, 55, 987, ZoneId.of("Z"))); Timer t2 = new Timer(3, LocalDateTime.of(2018, 9, 5, 12, 20, 0), null, true); this.tlogic.pauseTimer(returnedTimers.get(2)); assertThat(this.tlogic.reactivateTimer(returnedTimers.get(2)).toString(), is(t2.toString())); }
@Test protected void testReactivateTimerNotValid() { List<Timer> returnedTimers = createTimers(3, true); when(this.timerStorage.getAll()).thenReturn(returnedTimers); when(this.env.getCurrentDateTime()).thenReturn(ZonedDateTime.of(2018, 2, 1, 4, 21, 55, 987, ZoneId.of("Z"))); assertThrows(IllegalArgumentException.class, () -> this.tlogic.reactivateTimer(returnedTimers.get(2))); }