@Test public void runs_the_command_after_the_timeout() throws InterruptedException { timeout = new CommandExecutingTimeout(new SpyCommand(), 1, TimeUnit.MILLISECONDS); timeout.start(); assertNumberOfTimeouts(1); }
@Override public synchronized void start() { if (scheduler != null) { throw new IllegalStateException("already started"); } scheduler = new Thread(delayedCommand, "Timeout"); scheduler.start(); }
CommandExecutingTimeout implements Timeout { @Override public synchronized void start() { if (scheduler != null) { throw new IllegalStateException("already started"); } scheduler = new Thread(delayedCommand, "Timeout"); scheduler.start(); } }
CommandExecutingTimeout implements Timeout { @Override public synchronized void start() { if (scheduler != null) { throw new IllegalStateException("already started"); } scheduler = new Thread(delayedCommand, "Timeout"); scheduler.start(); } CommandExecutingTimeout(Runnable command, long timeout, TimeUnit unit); }
CommandExecutingTimeout implements Timeout { @Override public synchronized void start() { if (scheduler != null) { throw new IllegalStateException("already started"); } scheduler = new Thread(delayedCommand, "Timeout"); scheduler.start(); } CommandExecutingTimeout(Runnable command, long timeout, TimeUnit unit); @Override synchronized void start(); @Override synchronized void cancel(); }
CommandExecutingTimeout implements Timeout { @Override public synchronized void start() { if (scheduler != null) { throw new IllegalStateException("already started"); } scheduler = new Thread(delayedCommand, "Timeout"); scheduler.start(); } CommandExecutingTimeout(Runnable command, long timeout, TimeUnit unit); @Override synchronized void start(); @Override synchronized void cancel();  }