public void setVariable(String name, Object value) { setVariable(name, new MethodExecutionResult(value, Object.class)); }
public void setVariable(String name, Object value) { setVariable(name, new MethodExecutionResult(value, Object.class)); }
protected MethodExecutionResult invokeMethod(Object instance, Method method, Object[] args) throws Throwable { Object[] convertedArgs = convertArgs(method, args); Object retval = callMethod(instance, method, convertedArgs); Class<?> retType = method.getReturnType(); return new MethodExecutionResult(retval, retType); }
protected MethodExecutionResult invokeMethod(Object instance, Method method, Object[] args) throws Throwable { Object[] convertedArgs = convertArgs(method, args); Object retval = callMethod(instance, method, convertedArgs); Class<?> retType = method.getReturnType(); return new MethodExecutionResult(retval, retType); }
private String getSlimExpressionResult(String variableNameWithDollar) { SlimExpressionEvaluator evaluator = new SlimExpressionEvaluator(); String expr = variableNameWithDollar.substring(2, variableNameWithDollar.length() - 1); Map<String, MethodExecutionResult> symbols = new HashMap<>(); for (Map.Entry<String, String> symbol : testContext.getSymbols().entrySet()) { if (symbol.getValue().startsWith("!{")) { symbol.setValue(HtmlValueOfSymbol(symbol.getValue())); } symbols.put(symbol.getKey(), new MethodExecutionResult(symbol.getValue(), Object.class)); } evaluator.setContext(symbols); Object value; try { value = evaluator.evaluate(expr); } catch (IllegalArgumentException e) { value = e.getMessage(); } return value == null ? "null" : value.toString(); }
private String getSlimExpressionResult(String variableNameWithDollar) { SlimExpressionEvaluator evaluator = new SlimExpressionEvaluator(); String expr = variableNameWithDollar.substring(2, variableNameWithDollar.length() - 1); Map<String, MethodExecutionResult> symbols = new HashMap<>(); for (Map.Entry<String, String> symbol : testContext.getSymbols().entrySet()) { if (symbol.getValue().startsWith("!{")) { symbol.setValue(HtmlValueOfSymbol(symbol.getValue())); } symbols.put(symbol.getKey(), new MethodExecutionResult(symbol.getValue(), Object.class)); } evaluator.setContext(symbols); Object value; try { value = evaluator.evaluate(expr); } catch (IllegalArgumentException e) { value = e.getMessage(); } return value == null ? "null" : value.toString(); }