Package greed.model

Examples of greed.model.Param


        StringBuilder sb = new StringBuilder();
        sb.append("{    \n");
        sb.append("\"Abcde\"\n, \"12345\", \n\n\n");
        sb.append("\"Hello\"\n");
        sb.append(", \"world\"    }");
        String[] parsedValueList = trait.parseValue(sb.toString(), new Param("arg", Type.STRING_ARRAY_TYPE, 0)).getValueList();
        for (String pv : parsedValueList)
            System.out.println(pv);
        Assert.assertArrayEquals("Parsed value is " + Arrays.toString(parsedValueList), parsedValueList,
                new String[]{"\"Abcde\"", "\"12345\"", "\"Hello\"", "\"world\""});
    }
View Full Code Here


    public void parseOtherArrayTest() {
        CppLanguage trait = CppLanguage.instance;
        StringBuilder sb = new StringBuilder();
        sb.append("{123,    ");
        sb.append("\n123\n,125,999,\n\n12\n,123\n    } \n");
        String[] parsedValueList = trait.parseValue(sb.toString(), new Param("arg", Type.LONG_ARRAY_TYPE, 0)).getValueList();
        for (String pv : parsedValueList)
            System.out.println(pv);
        Assert.assertArrayEquals("Parsed value is " + Arrays.toString(parsedValueList), parsedValueList,
                new String[]{"123LL", "123LL", "125LL", "999LL", "12LL", "123LL"});
    }
View Full Code Here

    @Test
    public void testRenderHtmlStringQuote() {
        HashMap<String, Object> model = new HashMap<String, Object>();
        model.put("stringParam", new ParamValue(
                    new Param("stringParam", Type.STRING_TYPE, 0),
                    "\"quoted\"")
                );

        String result = engine.render("${stringParam;html}", model);
        System.out.println(result);
        assertThat(result, equalTo("&quot;quoted&quot;"));

        model.put("gridParam", new ParamValue(
                    new Param("gridParam", Type.STRING_ARRAY_TYPE, 1),
                    new String[] {"\"\"", ".."}
                    )
                );
        String gridResult = engine.render("${gridParam;html(grid)}", model);
        System.out.println(gridResult);
View Full Code Here

class TestModelFixtures {

    private TestModelFixtures() { }

    static Map<String, Object> buildStubbingModel() {
        Param param1 = new Param("arg1", Type.INT_TYPE, 0);
        Param param2 = new Param("arg2", Type.LONG_ARRAY_TYPE, 1);
        Param param3 = new Param("arg3", Type.STRING_ARRAY_TYPE, 2);

        Type retType = Type.STRING_ARRAY_TYPE;

        Method method = new Method("TestMethod", retType, new Param[]{param1, param2, param3});

        String[] valueList0 = new String[]{"919, 111, 234", "234, 567, 555"};
        String[] valueList1 = new String[]{"\"a\", \"b\", \"c\"", "\"d\""};
        String[] valueList2 = new String[]{"\"abcd\", \"efg\"", "\"123\", \"456\""};
        Testcase case0 = new Testcase(0, new ParamValue[]{
                new ParamValue(param1, "15"),
                new ParamValue(param2, valueList0),
                new ParamValue(param3, valueList1)
        }, new ParamValue(new Param("return", retType, 0), valueList2));

        Problem problem = new Problem("Test", 250, "TestClass", 2000, 256, method, new Testcase[]{case0}, null);

        Map<String, Object> model = new HashMap<String, Object>();
        model.put("Problem", problem);
View Full Code Here

TOP

Related Classes of greed.model.Param

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.