@Test(expected = VariableNotFoundException.class) public void should_throw_exception_for_unknown_variable() throws Exception { resolver.resolveVariable("unknown"); }
public Object resolveVariable(String variableName) throws VariableNotFoundException { final Object resolvedValue = tryResolveVariable(variableName); if (resolvedValue == null) { throw new VariableNotFoundException("No variable '" + variableName + "' among the predefined ones" + (isIncludeKnownVariablesInException()? ": " + knownVariables.keySet() : ".")); } if (newVariableEncounteredListener != null) { newVariableEncounteredListener.handleNewVariableEncountered(variableName); } return resolvedValue; }
PredefinedVariableResolver { public Object resolveVariable(String variableName) throws VariableNotFoundException { final Object resolvedValue = tryResolveVariable(variableName); if (resolvedValue == null) { throw new VariableNotFoundException("No variable '" + variableName + "' among the predefined ones" + (isIncludeKnownVariablesInException()? ": " + knownVariables.keySet() : ".")); } if (newVariableEncounteredListener != null) { newVariableEncounteredListener.handleNewVariableEncountered(variableName); } return resolvedValue; } }
PredefinedVariableResolver { public Object resolveVariable(String variableName) throws VariableNotFoundException { final Object resolvedValue = tryResolveVariable(variableName); if (resolvedValue == null) { throw new VariableNotFoundException("No variable '" + variableName + "' among the predefined ones" + (isIncludeKnownVariablesInException()? ": " + knownVariables.keySet() : ".")); } if (newVariableEncounteredListener != null) { newVariableEncounteredListener.handleNewVariableEncountered(variableName); } return resolvedValue; } PredefinedVariableResolver(
            final PredefinedVariableResolver.NewVariableEncounteredListener newVariableEncounteredListener); }
PredefinedVariableResolver { public Object resolveVariable(String variableName) throws VariableNotFoundException { final Object resolvedValue = tryResolveVariable(variableName); if (resolvedValue == null) { throw new VariableNotFoundException("No variable '" + variableName + "' among the predefined ones" + (isIncludeKnownVariablesInException()? ": " + knownVariables.keySet() : ".")); } if (newVariableEncounteredListener != null) { newVariableEncounteredListener.handleNewVariableEncountered(variableName); } return resolvedValue; } PredefinedVariableResolver(
            final PredefinedVariableResolver.NewVariableEncounteredListener newVariableEncounteredListener); Object resolveVariable(String variableName); void declareVariable(final String name, final Object value); Map<String, Object> getDeclaredVariables(); void setIncludeKnownVariablesInException(
            boolean includeKnownVariablesInException); boolean isIncludeKnownVariablesInException(); void setUnknownVariableResolver(ElVariableResolver unknownVariableResolver); ElVariableResolver getUnknownVariableResolver(); }
PredefinedVariableResolver { public Object resolveVariable(String variableName) throws VariableNotFoundException { final Object resolvedValue = tryResolveVariable(variableName); if (resolvedValue == null) { throw new VariableNotFoundException("No variable '" + variableName + "' among the predefined ones" + (isIncludeKnownVariablesInException()? ": " + knownVariables.keySet() : ".")); } if (newVariableEncounteredListener != null) { newVariableEncounteredListener.handleNewVariableEncountered(variableName); } return resolvedValue; } PredefinedVariableResolver(
            final PredefinedVariableResolver.NewVariableEncounteredListener newVariableEncounteredListener); Object resolveVariable(String variableName); void declareVariable(final String name, final Object value); Map<String, Object> getDeclaredVariables(); void setIncludeKnownVariablesInException(
            boolean includeKnownVariablesInException); boolean isIncludeKnownVariablesInException(); void setUnknownVariableResolver(ElVariableResolver unknownVariableResolver); ElVariableResolver getUnknownVariableResolver();  }