Wrapped System.currentTimeMillis() and Thread.sleep() for testability.

This commit is contained in:
akwizgran
2012-12-15 04:58:35 +00:00
parent 61e59f816d
commit 3e2e7286fe
26 changed files with 146 additions and 77 deletions

View File

@@ -8,4 +8,7 @@ public interface Clock {
/** @see {@link java.lang.System#currentTimeMillis()} */
long currentTimeMillis();
/** @see {@link java.lang.Thread.sleep(long)} */
void sleep(long milliseconds) throws InterruptedException;
}

View File

@@ -6,4 +6,8 @@ public class SystemClock implements Clock {
public long currentTimeMillis() {
return System.currentTimeMillis();
}
public void sleep(long milliseconds) throws InterruptedException {
Thread.sleep(milliseconds);
}
}