### Question:
SchedulerUtil { public static Date getNextExecution(TaskDefinition taskDefinition) { Calendar nextTime = Calendar.getInstance(); try { Date firstTime = taskDefinition.getStartTime(); if (firstTime != null) { Date currentTime = new Date(); if (firstTime.after(currentTime)) { return firstTime; } long repeatInterval = taskDefinition.getRepeatInterval(); if (repeatInterval == 0) { return firstTime; } long betweenTime = currentTime.getTime() - firstTime.getTime(); long lastTime = (betweenTime % (repeatInterval * 1000)); long additional = ((repeatInterval * 1000) - lastTime); nextTime.setTime(new Date(currentTime.getTime() + additional)); log.debug("The task " + taskDefinition.getName() + " will start at " + nextTime.getTime()); } } catch (Exception e) { log.error("Failed to get next execution time for " + taskDefinition.getName(), e); } return nextTime.getTime(); } private  SchedulerUtil(); static void startup(Properties p); static void shutdown(); static void sendSchedulerError(Throwable throwable); static String getExceptionAsString(Throwable t); static Date getNextExecution(TaskDefinition taskDefinition);  }### Answer:
@Test public void getNextExecution_shouldGetTheCorrectRepeatInterval() { Calendar startTime = Calendar.getInstance(); Long repeatInterval = (long) (4 * 60); TaskDefinition taskDefinition = new TaskDefinition(); taskDefinition.setStartTime(startTime.getTime()); taskDefinition.setRepeatInterval(repeatInterval); startTime.add(Calendar.MINUTE, 4); Date nextTime = SchedulerUtil.getNextExecution(taskDefinition); assertEquals(startTime.getTime(), nextTime); }