@Test(expected = NullPointerException.class) public void testAddNullRunnable() { this.executionList.add(null, mock(Executor.class)); }
public void add(Runnable runnable, Executor executor) { if (runnable == null) { throw new NullPointerException("Runnable can not be null!"); } if (executor == null) { logger.info("Executor for listenablefuture is null, will use default executor!"); executor = DEFAULT_EXECUTOR; } synchronized (this) { if (!executed) { runnables = new RunnableExecutorPair(runnable, executor, runnables); return; } } executeListener(runnable, executor); }
ExecutionList { public void add(Runnable runnable, Executor executor) { if (runnable == null) { throw new NullPointerException("Runnable can not be null!"); } if (executor == null) { logger.info("Executor for listenablefuture is null, will use default executor!"); executor = DEFAULT_EXECUTOR; } synchronized (this) { if (!executed) { runnables = new RunnableExecutorPair(runnable, executor, runnables); return; } } executeListener(runnable, executor); } }
ExecutionList { public void add(Runnable runnable, Executor executor) { if (runnable == null) { throw new NullPointerException("Runnable can not be null!"); } if (executor == null) { logger.info("Executor for listenablefuture is null, will use default executor!"); executor = DEFAULT_EXECUTOR; } synchronized (this) { if (!executed) { runnables = new RunnableExecutorPair(runnable, executor, runnables); return; } } executeListener(runnable, executor); } ExecutionList(); }
ExecutionList { public void add(Runnable runnable, Executor executor) { if (runnable == null) { throw new NullPointerException("Runnable can not be null!"); } if (executor == null) { logger.info("Executor for listenablefuture is null, will use default executor!"); executor = DEFAULT_EXECUTOR; } synchronized (this) { if (!executed) { runnables = new RunnableExecutorPair(runnable, executor, runnables); return; } } executeListener(runnable, executor); } ExecutionList(); void add(Runnable runnable, Executor executor); void execute(); }
ExecutionList { public void add(Runnable runnable, Executor executor) { if (runnable == null) { throw new NullPointerException("Runnable can not be null!"); } if (executor == null) { logger.info("Executor for listenablefuture is null, will use default executor!"); executor = DEFAULT_EXECUTOR; } synchronized (this) { if (!executed) { runnables = new RunnableExecutorPair(runnable, executor, runnables); return; } } executeListener(runnable, executor); } ExecutionList(); void add(Runnable runnable, Executor executor); void execute();  }