SymbolPSymbolStep extends SymbolStep implements Serializable { @Override public ExecuteResult execute(int i, ConnectorManager connectors) { try { return getExecuteResult(i, connectors, pSymbol.execute(connectors)); } catch (Exception e) { LOGGER.error(LoggerMarkers.LEARNER, "The symbol could not be executed.", e); return new ExecuteResult(false, String.valueOf(i + 1)); } }  @Override ExecuteResult execute(int i, ConnectorManager connectors); @JsonProperty("pSymbol") ParameterizedSymbol getPSymbol(); @JsonProperty("pSymbol") void setPSymbol(ParameterizedSymbol symbol);  }
@Test public void shouldGetCorrectOutputOnSuccessAndNotNegatedAndWithoutCustomMessage() { given(pSymbol.execute(connectors)).willReturn(new ExecuteResult(true)); final ExecuteResult r1 = step.execute(0, connectors); assertEquals(ExecuteResult.DEFAULT_SUCCESS_OUTPUT, r1.getOutput()); }
@Test public void shouldGetCorrectOutputOnSuccessAndNotNegatedAndWithCustomMessage() { given(pSymbol.execute(connectors)).willReturn(new ExecuteResult(true, "login successful")); final ExecuteResult r1 = step.execute(0, connectors); assertEquals(ExecuteResult.DEFAULT_SUCCESS_OUTPUT + " (login successful)", r1.getOutput()); }
@Test public void shouldGetCorrectOutputOnSuccessAndNegatedAndWithoutCustomMessage() { step.setNegated(true); given(pSymbol.execute(connectors)).willReturn(new ExecuteResult(true)); final ExecuteResult r1 = step.execute(0, connectors); assertEquals(ExecuteResult.DEFAULT_ERROR_OUTPUT + " (1)", r1.getOutput()); }
@Test public void shouldGetCorrectOutputOnSuccessAndNegatedAndWithCustomMessage() { step.setNegated(true); given(pSymbol.execute(connectors)).willReturn(new ExecuteResult(true, "login successful")); final ExecuteResult r1 = step.execute(0, connectors); assertEquals(ExecuteResult.DEFAULT_ERROR_OUTPUT + " (login successful)", r1.getOutput()); }
@Test public void shouldGetCorrectOutputOnFailureAndNotNegated() { given(pSymbol.execute(connectors)).willReturn(new ExecuteResult(false)); final ExecuteResult r1 = step.execute(0, connectors); assertEquals(ExecuteResult.DEFAULT_ERROR_OUTPUT + " (1)", r1.getOutput()); }
@Test public void shouldGetCorrectOutputOnFailureAndNegated() { step.setNegated(true); given(pSymbol.execute(connectors)).willReturn(new ExecuteResult(false)); final ExecuteResult r1 = step.execute(0, connectors); assertEquals(ExecuteResult.DEFAULT_SUCCESS_OUTPUT, r1.getOutput()); }
@Test public void shouldCatchGlobalException() { given(pSymbol.execute(connectors)).willThrow(IllegalStateException.class); final ExecuteResult r1 = step.execute(0, connectors); assertEquals(ExecuteResult.DEFAULT_ERROR_OUTPUT + " (1)", r1.getOutput()); }