JobExecutor implements ThreadExecutor { @Override public void execute(Runnable runnable) { if (runnable == null) { throw new IllegalArgumentException("Runnable to execute cannot be null."); } this.threadPoolExecutor.execute(runnable); } @Inject  JobExecutor(); @Override void execute(Runnable runnable);  }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionWhenGivenNullRunnable() throws Exception { jobExecutor.execute(null); }