Examples of GString


Examples of groovy.lang.GString

        assertEquals("Should have just 1 item left: " + list, 1, list.size());
    }

    public void testCoerceGStringToString() throws Throwable {
        GString param = new GString(new Object[]{"James"}) {
            public String[] getStrings() {
                return new String[]{"Hello "};
            }
        };
        Object value = invoke(this, "methodTakesString", new Object[]{param});
        assertEquals("converted GString to string", param.toString(), value);
    }
View Full Code Here

Examples of groovy.lang.GString

        Object value = invoke(this, "methodTakesString", new Object[]{param});
        assertEquals("converted GString to string", param.toString(), value);
    }

    public void testCoerceGStringToStringOnGetBytes() throws Throwable {
        GString param = new GString(new Object[]{"US-ASCII"}) {
            public String[] getStrings() {
                return new String[]{""};
            }
        };
        Object value = invoke("test", "getBytes", new Object[]{param});
View Full Code Here

Examples of groovy.lang.GString

        assertAsBoolean(true, "TRUE");
        assertAsBoolean(true, "false");
        assertAsBoolean(false, Boolean.FALSE);
        assertAsBoolean(false, (String) null);
        assertAsBoolean(false, "");
        GString emptyGString = new GString(new Object[]{""}) {
            public String[] getStrings() {
                return new String[]{""};
            }
        };
        assertAsBoolean(false, emptyGString);
        GString nonEmptyGString = new GString(new Object[]{"x"}) {
            public String[] getStrings() {
                return new String[]{"x"};
            }
        };
        assertAsBoolean(true, nonEmptyGString);
View Full Code Here

Examples of groovy.lang.GString

    public void testInvokeConstructorOneParamWhichIsNull() throws Throwable {
        assertConstructor(new DummyBean("Bob", new Integer(1707)), new Object[]{"Bob", new Integer(1707)});
    }

    public void testConstructorWithGStringCoercion() throws Throwable {
        GString gstring = new GString(new Object[]{new Integer(123)}) {
            public String[] getStrings() {
                return new String[]{""};
            }
        };

        Object expected = new Long(gstring.toString());

        assertConstructor(expected, new Object[]{gstring});
    }
View Full Code Here

Examples of groovy.lang.GString

        assertEquals("Should have just 1 item left: " + list, 1, list.size());
    }

    public void testCoerceGStringToString() throws Throwable {
        GString param = new GString(new Object[]{"James"}) {
            public String[] getStrings() {
                return new String[]{"Hello "};
            }
        };
        Object value = invoke(this, "methodTakesString", new Object[]{param});
        assertEquals("converted GString to string", param.toString(), value);
    }
View Full Code Here

Examples of groovy.lang.GString

        Object value = invoke(this, "methodTakesString", new Object[]{param});
        assertEquals("converted GString to string", param.toString(), value);
    }

    public void testCoerceGStringToStringOnGetBytes() throws Throwable {
        GString param = new GString(new Object[]{"US-ASCII"}) {
            public String[] getStrings() {
                return new String[]{""};
            }
        };
        Object value = invoke("test", "getBytes", new Object[]{param});
View Full Code Here

Examples of groovy.lang.GString

        assertAsBoolean(true, "TRUE");
        assertAsBoolean(true, "false");
        assertAsBoolean(false, Boolean.FALSE);
        assertAsBoolean(false, (String) null);
        assertAsBoolean(false, "");
        GString emptyGString = new GString(new Object[]{""}) {
            public String[] getStrings() {
                return new String[]{""};
            }
        };
        assertAsBoolean(false, emptyGString);
        GString nonEmptyGString = new GString(new Object[]{"x"}) {
            public String[] getStrings() {
                return new String[]{"x"};
            }
        };
        assertAsBoolean(true, nonEmptyGString);
View Full Code Here

Examples of groovy.lang.GString

    public void testInvokeConstructorOneParamWhichIsNull() throws Throwable {
        assertConstructor(new DummyBean("Bob", new Integer(1707)), new Object[]{"Bob", new Integer(1707)});
    }

    public void testConstructorWithGStringCoercion() throws Throwable {
        GString gstring = new GString(new Object[]{new Integer(123)}) {
            public String[] getStrings() {
                return new String[]{""};
            }
        };

        Object expected = new Long(gstring.toString());

        assertConstructor(expected, new Object[]{gstring});
    }
View Full Code Here

Examples of groovy.lang.GString

        assertAsBoolean(true, "TRUE");
        assertAsBoolean(true, "false");
        assertAsBoolean(false, Boolean.FALSE);
        assertAsBoolean(false, (String) null);
        assertAsBoolean(false, "");
        GString emptyGString = new GString(new Object[]{""}) {
            public String[] getStrings() {
                return new String[]{""};
            }
        };
        assertAsBoolean(false, emptyGString);
        GString nonEmptyGString = new GString(new Object[]{"x"}) {
            public String[] getStrings() {
                return new String[]{"x"};
            }
        };
        assertAsBoolean(true, nonEmptyGString);
View Full Code Here

Examples of groovy.lang.GString

    public void testInvokeConstructorOneParamWhichIsNull() throws Throwable {
        assertConstructor(new DummyBean("Bob", new Integer(1707)), new Object[]{"Bob", new Integer(1707)});
    }

    public void testConstructorWithGStringCoercion() throws Throwable {
        GString gstring = new GString(new Object[]{new Integer(123)}) {
            public String[] getStrings() {
                return new String[]{""};
            }
        };

        Object expected = new Long(gstring.toString());

        assertConstructor(expected, new Object[]{gstring});
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.