@Test protected void testSearchTimerIdWithoutList() { List<Timer> returnedTimers = new ArrayList<>(); when(this.timerStorage.getAll()).thenReturn(returnedTimers); assertThat(this.tlogic.searchTimerId(), is(1)); }
public int searchTimerId() { int id = 1; List<Timer> timerList = this.timerStorage.getAll(); timerList.sort((timer1, timer2) -> timer1.getId() - timer2.getId()); for (Timer t : timerList) { if (t.getId() == id) { id++; } else { return id; } } return id; }
TimerLogic implements RunnableService { public int searchTimerId() { int id = 1; List<Timer> timerList = this.timerStorage.getAll(); timerList.sort((timer1, timer2) -> timer1.getId() - timer2.getId()); for (Timer t : timerList) { if (t.getId() == id) { id++; } else { return id; } } return id; } }
TimerLogic implements RunnableService { public int searchTimerId() { int id = 1; List<Timer> timerList = this.timerStorage.getAll(); timerList.sort((timer1, timer2) -> timer1.getId() - timer2.getId()); for (Timer t : timerList) { if (t.getId() == id) { id++; } else { return id; } } return id; }  }
TimerLogic implements RunnableService { public int searchTimerId() { int id = 1; List<Timer> timerList = this.timerStorage.getAll(); timerList.sort((timer1, timer2) -> timer1.getId() - timer2.getId()); for (Timer t : timerList) { if (t.getId() == id) { id++; } else { return id; } } return id; }  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(); }
TimerLogic implements RunnableService { public int searchTimerId() { int id = 1; List<Timer> timerList = this.timerStorage.getAll(); timerList.sort((timer1, timer2) -> timer1.getId() - timer2.getId()); for (Timer t : timerList) { if (t.getId() == id) { id++; } else { return id; } } return id; }  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();  }