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