GenericReceiveAsciiAction extends AsciiAction { @Override public void execute(State state) throws WorkflowExecutionException { TlsContext tlsContext = state.getTlsContext(); if (isExecuted()) { throw new WorkflowExecutionException("Action already executed!"); } try { LOGGER.debug("Receiving ASCII message..."); byte[] fetchData = tlsContext.getTransportHandler().fetchData(); setAsciiText(new String(fetchData, getEncoding())); LOGGER.info("Received:" + getAsciiText()); setExecuted(true); } catch (IOException E) { LOGGER.debug(E); setExecuted(false); } } private  GenericReceiveAsciiAction();  GenericReceiveAsciiAction(String encoding); @Override void execute(State state); @Override void reset(); @Override boolean executedAsPlanned();  }
@Test public void testExecute() throws Exception { ((FakeTransportHandler) tlsContext.getTransportHandler()).setFetchableByte(asciiToCheck); action.execute(state); assertEquals(new String(asciiToCheck, "US-ASCII"), action.getAsciiText()); assertTrue(action.isExecuted()); actionException.execute(state); assertFalse(actionException.isExecuted()); }
@Test(expected = WorkflowExecutionException.class) public void testExecuteWorkflowExecutionException() { action.execute(state); action.execute(state); }