ExpressionFunctionUtils { static MethodDeclaration getConstantExpressionMethodDeclaration(final String methodName, final Constant constant, final ClassOrInterfaceType returnedType, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { String variableName = "constantVariable"; final BlockStmt body = getConstantExpressionBlockStmt(variableName, constant, returnedType, parameterNameTypeMap); return getExpressionMethodDeclaration(methodName, variableName, body, returnedType, parameterNameTypeMap); } private  ExpressionFunctionUtils();   }
@Test public void getConstantExpressionMethodDeclaration() { Constant constant = constantSupplier.get(); int methodArity = new Random().nextInt(20); String methodName = String.format(METHOD_NAME_TEMPLATE, constant.getClass().getSimpleName(), methodArity); MethodDeclaration retrieved = ExpressionFunctionUtils.getConstantExpressionMethodDeclaration(methodName, constant, DOUBLE_CLASS, DEFAULT_PARAMETERTYPE_MAP); String expectedVariableDeclaration = String.format("%1$s constantVariable = %2$s;", Double.class.getName(), constant.getValue()); commonValidateConstant(retrieved, constant, methodName, Double.class.getName(), expectedVariableDeclaration); constant = new Constant(); constant.setDataType(DataType.STRING); constant.setValue("EXPECTED"); methodArity = new Random().nextInt(20); methodName = String.format(METHOD_NAME_TEMPLATE, constant.getClass().getSimpleName(), methodArity); retrieved = ExpressionFunctionUtils.getConstantExpressionMethodDeclaration(methodName, constant, STRING_CLASS, DEFAULT_PARAMETERTYPE_MAP); expectedVariableDeclaration = String.format("%1$s constantVariable = \"%2$s\";", String.class.getName(), constant.getValue()); commonValidateConstant(retrieved, constant, methodName, String.class.getName(), expectedVariableDeclaration); }