### Question:
Worker implements Runnable { public void setNextWorker(final Worker nextWorker) { if (this.nextWorker != null) { throw new IllegalStateException("nextWorker should only be set once"); } this.nextWorker = nextWorker; } Worker(final Minijax minijax, final SelectorProvider selectorProvider); boolean isRunning(); void setRunning(final boolean running); Worker getNextWorker(); void setNextWorker(final Worker nextWorker); void accept(final SocketChannel socketChannel); @Override void run();  }### Answer:
@Test(expected = IllegalStateException.class) public void testSetNextWorker() throws IOException { final Worker worker = new Worker(null, new MockSelectorProvider()); worker.setNextWorker(worker); worker.setNextWorker(worker); }