@Test public void testInjectVariables() { VariableAwareFact factMock = mock(VariableAwareFact.class); variableStatementResolver.addStatement("a ${b} c", factMock, Fact.class); assertEquals(factMock, variableStatementResolver.resolveStatement("a value c", Fact.class)); Map<String, String> expectedVariables = new HashMap<String, String>(); expectedVariables.put("b", "value"); verify(factMock, times(1)).setVariables(expectedVariables); verifyNoMoreInteractions(factMock); }
private void injectVariables(Map<String, String> variables, Statement statement) { if (statement instanceof VariablesAware) { ((VariablesAware) statement).setVariables(variables); } }
VariableStatementResolver implements StatementResolver { private void injectVariables(Map<String, String> variables, Statement statement) { if (statement instanceof VariablesAware) { ((VariablesAware) statement).setVariables(variables); } } }
VariableStatementResolver implements StatementResolver { private void injectVariables(Map<String, String> variables, Statement statement) { if (statement instanceof VariablesAware) { ((VariablesAware) statement).setVariables(variables); } } VariableStatementResolver(); }
VariableStatementResolver implements StatementResolver { private void injectVariables(Map<String, String> variables, Statement statement) { if (statement instanceof VariablesAware) { ((VariablesAware) statement).setVariables(variables); } } VariableStatementResolver(); @Override void addStatement(String statementName, Statement statement, Class<? extends Statement> type); @Override T resolveStatement(String statementName, Class<T> type); }
VariableStatementResolver implements StatementResolver { private void injectVariables(Map<String, String> variables, Statement statement) { if (statement instanceof VariablesAware) { ((VariablesAware) statement).setVariables(variables); } } VariableStatementResolver(); @Override void addStatement(String statementName, Statement statement, Class<? extends Statement> type); @Override T resolveStatement(String statementName, Class<T> type);  }