Examples of Convention


Examples of org.gradle.api.plugins.Convention

    }

    @Test
    public void canInvokeMethodDefinedByConvention() {
        Bean bean = new Bean();
        Convention convention = new DefaultConvention();
        convention.getPlugins().put("bean", new ConventionBean());

        assertFalse(bean.hasMethod("conventionMethod", "a", "b"));

        bean.setConvention(convention);
View Full Code Here

Examples of org.gradle.api.plugins.Convention

    }

    @Test
    public void canInvokeMethodsOnJavaObjectFromGroovy() {
        Bean bean = new Bean();
        Convention convention = new DefaultConvention();
        bean.setConvention(convention);
        convention.getPlugins().put("bean", new ConventionBean());
        DynamicObjectHelperTestHelper.assertCanCallMethods(bean);
    }
View Full Code Here

Examples of org.gradle.api.plugins.Convention

    }

    @Test
    public void canInvokeMethodsOnGroovyObjectFromGroovy() {
        GroovyBean bean = new GroovyBean();
        Convention convention = new DefaultConvention();
        bean.setConvention(convention);
        convention.getPlugins().put("bean", new ConventionBean());
        DynamicObjectHelperTestHelper.assertCanCallMethods(bean);
    }
View Full Code Here

Examples of org.gradle.api.plugins.Convention

    }

    @Test
    public void canInvokeMethodsOnJavaSubClassOfGroovyObjectFromGroovy() {
        DynamicBean bean = new DynamicBean();
        Convention convention = new DefaultConvention();
        bean.setConvention(convention);
        convention.getPlugins().put("bean", new ConventionBean());
        DynamicObjectHelperTestHelper.assertCanCallMethods(bean);
    }
View Full Code Here

Examples of org.gradle.api.plugins.Convention

    }

    @Test
    public void conventionPropertiesAreInherited() {
        Bean bean = new Bean();
        Convention convention = new DefaultConvention();
        ConventionBean conventionBean = new ConventionBean();
        conventionBean.setConventionProperty("value");
        convention.getPlugins().put("convention", conventionBean);
        bean.setConvention(convention);

        DynamicObject inherited = bean.getInheritable();
        assertTrue(inherited.hasProperty("conventionProperty"));
        assertThat(inherited.getProperty("conventionProperty"), equalTo((Object) "value"));
View Full Code Here

Examples of org.gradle.api.plugins.Convention

        Bean bean = new Bean();

        DynamicObject inherited = bean.getInheritable();
        assertFalse(inherited.hasProperty("conventionProperty"));

        Convention convention = new DefaultConvention();
        ConventionBean conventionBean = new ConventionBean();
        conventionBean.setConventionProperty("value");
        convention.getPlugins().put("convention", conventionBean);
        bean.setConvention(convention);

        assertTrue(inherited.hasProperty("conventionProperty"));
        assertThat(inherited.getProperty("conventionProperty"), equalTo((Object) "value"));
    }
View Full Code Here

Examples of org.gradle.api.plugins.Convention

    }

    @Test
    public void conventionMethodsAreInherited() {
        Bean bean = new Bean();
        Convention convention = new DefaultConvention();
        convention.getPlugins().put("convention", new ConventionBean());
        bean.setConvention(convention);

        DynamicObject inherited = bean.getInheritable();
        assertTrue(inherited.hasMethod("conventionMethod", "a", "b"));
        assertThat(inherited.invokeMethod("conventionMethod", "a", "b"), equalTo((Object) "convention:a.b"));
View Full Code Here

Examples of org.gradle.api.plugins.Convention

    }

    @Test
    public void additionalObjectMethodsAreInherited() {
        Bean other = new Bean();
        Convention convention = new DefaultConvention();
        convention.getPlugins().put("convention", new ConventionBean());
        other.setConvention(convention);

        Bean bean = new Bean();
        bean.helper.addObject(other, DynamicObjectHelper.Location.BeforeConvention);
View Full Code Here

Examples of org.gradle.api.plugins.Convention

    }

    @Test
    public void parentMethodsAreInherited() {
        Bean parent = new Bean();
        Convention convention = new DefaultConvention();
        convention.getPlugins().put("convention", new ConventionBean());
        parent.setConvention(convention);
        Bean bean = new Bean();
        bean.setParent(parent);

        DynamicObject inherited = bean.getInheritable();
View Full Code Here

Examples of org.gradle.api.plugins.Convention

    @Test
    public void doesNotOverrideMethodsFromDynamicObjectAwareInterface() throws Exception {
        DynamicObjectAwareBean bean = generator.generate(DynamicObjectAwareBean.class).newInstance();
        assertThat(bean.getConvention(), sameInstance(bean.conv));
        Convention newConvention = new DefaultConvention();
        bean.setConvention(newConvention);
        assertThat(bean.getConvention(), sameInstance(newConvention));
        assertThat(bean.getAsDynamicObject(), sameInstance((DynamicObject) newConvention));
    }
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.