@Test(expected = IllegalStateException.class) public void shouldNotWriteCommand() throws Exception { StartCommand start = new StartCommand(); control.writeCommand(start); }
public void writeCommand(Command command) throws Exception { checkConnected(); switch (command.getKind()) { case PREPARE: writeCommand((PrepareCommand) command); break; case START: writeCommand((StartCommand) command); break; case ABORT: writeCommand((AbortCommand) command); break; case AWAIT: writeCommand((AwaitCommand) command); break; case NOTIFY: writeCommand((NotifyCommand) command); break; case CLOSE: writeCommand((CloseCommand) command); break; default: throw new IllegalArgumentException("Urecognized command kind: " + command.getKind()); } }
Control { public void writeCommand(Command command) throws Exception { checkConnected(); switch (command.getKind()) { case PREPARE: writeCommand((PrepareCommand) command); break; case START: writeCommand((StartCommand) command); break; case ABORT: writeCommand((AbortCommand) command); break; case AWAIT: writeCommand((AwaitCommand) command); break; case NOTIFY: writeCommand((NotifyCommand) command); break; case CLOSE: writeCommand((CloseCommand) command); break; default: throw new IllegalArgumentException("Urecognized command kind: " + command.getKind()); } } }
Control { public void writeCommand(Command command) throws Exception { checkConnected(); switch (command.getKind()) { case PREPARE: writeCommand((PrepareCommand) command); break; case START: writeCommand((StartCommand) command); break; case ABORT: writeCommand((AbortCommand) command); break; case AWAIT: writeCommand((AwaitCommand) command); break; case NOTIFY: writeCommand((NotifyCommand) command); break; case CLOSE: writeCommand((CloseCommand) command); break; default: throw new IllegalArgumentException("Urecognized command kind: " + command.getKind()); } } Control(URL location); }
Control { public void writeCommand(Command command) throws Exception { checkConnected(); switch (command.getKind()) { case PREPARE: writeCommand((PrepareCommand) command); break; case START: writeCommand((StartCommand) command); break; case ABORT: writeCommand((AbortCommand) command); break; case AWAIT: writeCommand((AwaitCommand) command); break; case NOTIFY: writeCommand((NotifyCommand) command); break; case CLOSE: writeCommand((CloseCommand) command); break; default: throw new IllegalArgumentException("Urecognized command kind: " + command.getKind()); } } Control(URL location); void connect(); void disconnect(); void writeCommand(Command command); CommandEvent readEvent(); CommandEvent readEvent(int timeout, TimeUnit unit); boolean isConnected(); void notifyBarrier(String barrierName); void sendAwaitBarrier(String barrierName); }
Control { public void writeCommand(Command command) throws Exception { checkConnected(); switch (command.getKind()) { case PREPARE: writeCommand((PrepareCommand) command); break; case START: writeCommand((StartCommand) command); break; case ABORT: writeCommand((AbortCommand) command); break; case AWAIT: writeCommand((AwaitCommand) command); break; case NOTIFY: writeCommand((NotifyCommand) command); break; case CLOSE: writeCommand((CloseCommand) command); break; default: throw new IllegalArgumentException("Urecognized command kind: " + command.getKind()); } } Control(URL location); void connect(); void disconnect(); void writeCommand(Command command); CommandEvent readEvent(); CommandEvent readEvent(int timeout, TimeUnit unit); boolean isConnected(); void notifyBarrier(String barrierName); void sendAwaitBarrier(String barrierName);  }