TaskManager { public void startUp() { if(state == State.INITIALIZED) { resultPollerThread = new Thread(new TaskResultPoller(), "TaskResultPoller"); resultPollerThread.setDaemon(true); resultPollerThread.start(); state = State.RUNNING; } else { throw new IllegalStateException("You tried to start a task manager but it's state was " + state + " instead of INITIALIZED!"); } } TaskManager();  TaskManager(ExecutorService executorService);  TaskManager(ExecutorService executorService, boolean usingEventQueue); void startUp(); void shutDown(); State getState(); Task<T> startTask(Callable<T> callable, String name); Task<T> startTask(Callable<T> callable, String name, String description); Task<T> startTask(Callable<T> callable, String name, String description, Map<String, String> metaData); int getNumberOfTasks(); Task<T> getTaskById(long taskId); Task<T> getTaskByCallable(Callable<T> callable); Map<Long, Task<T>> getTasks(); boolean isUsingEventQueue(); void setUsingEventQueue(boolean usingEventQueue); void addTaskListener(TaskListener<T> listener); void removeTaskListener(TaskListener<T> listener);  }
@Test(expected = IllegalStateException.class) public void startUpTwice() { instance.startUp(); instance.startUp(); }