### Question:
ThreadMonitor { public void watchScheduledThread(final ScheduledExecutorService scheduledService, final Runnable runnable, final long delay, final long duration, final TimeUnit timeUnit) { Reject.ifNull(scheduledService, runnable); workPool.submit(new WatchDog(new StartThread() { public Future<?> start() { return scheduledService.scheduleAtFixedRate(runnable, delay, duration, timeUnit); } @Override public String toString() { return MessageFormat.format( "ScheduledExecutable: {0} (start:{1} duration:{2} TimeUnit:{3}", runnable.toString(), delay, duration, timeUnit.toString()); } })); } @Inject  ThreadMonitor(ExecutorService workPool,
                         ShutdownManager shutdownManager,
                         @Named(SharedGuiceModule.DEBUG_THREAD_MANAGER) Debug debug); void watchThread(final ExecutorService service, final Runnable runnable); void watchScheduledThread(final ScheduledExecutorService scheduledService,
                                     final Runnable runnable,
                                     final long delay,
                                     final long duration,
                                     final TimeUnit timeUnit);  }### Answer:
@Test(expectedExceptions = NullPointerException.class) public void shouldNotAllowNullScheduledRunnable() { monitor.watchScheduledThread(mock(ScheduledExecutorService.class), null, 0, 0, TimeUnit.MILLISECONDS); }
@Test(expectedExceptions = NullPointerException.class) public void shouldNotAllowNullScheduledExecutorService() { monitor.watchScheduledThread(null, mock(Runnable.class), 0, 0, TimeUnit.MILLISECONDS); }
@Test public void shouldSubmitRunnableToScheduledExecutor() { Runnable mockRunnable = mock(Runnable.class); ScheduledExecutorService mockScheduledService = mockNoOpScheduledExecutor(); monitor.watchScheduledThread(mockScheduledService, mockRunnable, 1, 1, TimeUnit.DAYS); verify(mockScheduledService).scheduleAtFixedRate(eq(mockRunnable), anyLong(), anyLong(), any(TimeUnit.class)); }