@Test(expected = IllegalStateException.class) public void shouldNotStoreStatusIfAnExceptionOccurs() { Mockito.when(webServiceConnector.getStatus()).thenThrow(new ValidationException()); final ExecuteResult result = this.action.execute(connectors); Assert.assertFalse(result.isSuccess()); Assert.assertNull(variableStore.getStore().get("var")); variableStore.get("var"); }
@Override public ExecuteResult execute(ConnectorManager connector) { final WebServiceConnector webServiceConnector = connector.getConnector(WebServiceConnector.class); final VariableStoreConnector variableStore = connector.getConnector(VariableStoreConnector.class); try { final int status = webServiceConnector.getStatus(); variableStore.set(name, String.valueOf(status)); LOGGER.info(LoggerMarkers.LEARNER, "Set variable '{}' to status '{}'.", status); return getSuccessOutput(); } catch (Exception e) { LOGGER.info(LoggerMarkers.LEARNER, "Could not set variable '{}'"); return getFailedOutput(); } }
SetVariableByHttpStatusAction extends SymbolAction { @Override public ExecuteResult execute(ConnectorManager connector) { final WebServiceConnector webServiceConnector = connector.getConnector(WebServiceConnector.class); final VariableStoreConnector variableStore = connector.getConnector(VariableStoreConnector.class); try { final int status = webServiceConnector.getStatus(); variableStore.set(name, String.valueOf(status)); LOGGER.info(LoggerMarkers.LEARNER, "Set variable '{}' to status '{}'.", status); return getSuccessOutput(); } catch (Exception e) { LOGGER.info(LoggerMarkers.LEARNER, "Could not set variable '{}'"); return getFailedOutput(); } } }
SetVariableByHttpStatusAction extends SymbolAction { @Override public ExecuteResult execute(ConnectorManager connector) { final WebServiceConnector webServiceConnector = connector.getConnector(WebServiceConnector.class); final VariableStoreConnector variableStore = connector.getConnector(VariableStoreConnector.class); try { final int status = webServiceConnector.getStatus(); variableStore.set(name, String.valueOf(status)); LOGGER.info(LoggerMarkers.LEARNER, "Set variable '{}' to status '{}'.", status); return getSuccessOutput(); } catch (Exception e) { LOGGER.info(LoggerMarkers.LEARNER, "Could not set variable '{}'"); return getFailedOutput(); } }  }
SetVariableByHttpStatusAction extends SymbolAction { @Override public ExecuteResult execute(ConnectorManager connector) { final WebServiceConnector webServiceConnector = connector.getConnector(WebServiceConnector.class); final VariableStoreConnector variableStore = connector.getConnector(VariableStoreConnector.class); try { final int status = webServiceConnector.getStatus(); variableStore.set(name, String.valueOf(status)); LOGGER.info(LoggerMarkers.LEARNER, "Set variable '{}' to status '{}'.", status); return getSuccessOutput(); } catch (Exception e) { LOGGER.info(LoggerMarkers.LEARNER, "Could not set variable '{}'"); return getFailedOutput(); } }  @Override ExecuteResult execute(ConnectorManager connector); String getName(); void setName(String name); }
SetVariableByHttpStatusAction extends SymbolAction { @Override public ExecuteResult execute(ConnectorManager connector) { final WebServiceConnector webServiceConnector = connector.getConnector(WebServiceConnector.class); final VariableStoreConnector variableStore = connector.getConnector(VariableStoreConnector.class); try { final int status = webServiceConnector.getStatus(); variableStore.set(name, String.valueOf(status)); LOGGER.info(LoggerMarkers.LEARNER, "Set variable '{}' to status '{}'.", status); return getSuccessOutput(); } catch (Exception e) { LOGGER.info(LoggerMarkers.LEARNER, "Could not set variable '{}'"); return getFailedOutput(); } }  @Override ExecuteResult execute(ConnectorManager connector); String getName(); void setName(String name);  }