Package com.mycila.testing.core.annot

Examples of com.mycila.testing.core.annot.MycilaPlugins


     * @param c test class
     * @return a TestSetup instance which can be used to prepare a test with plugins
     */
    public static MycilaTesting from(Class<?> c) {
        notNull("Test class", c);
        MycilaPlugins mycilaPlugins = c.getAnnotation(MycilaPlugins.class);
        if (mycilaPlugins == null) {
            mycilaPlugins = new MycilaPlugins() {
                public Cache value() {
                    return Cache.SHARED;
                }

                public String descriptor() {
View Full Code Here


     * @param c test class
     * @return a TestSetup instance which can be used to prepare a test with plugins
     */
    public static MycilaTesting from(Class<?> c) {
        notNull("Test class", c);
        MycilaPlugins mycilaPlugins = c.getAnnotation(MycilaPlugins.class);
        if (mycilaPlugins == null) {
            mycilaPlugins = new MycilaPlugins() {
                public Cache value() {
                    return Cache.SHARED;
                }

                public String descriptor() {
View Full Code Here

@MycilaPlugins(value = UNSHARED, descriptor = "")
public final class MycilaTestingTest {

    @Test
    public void test_share_plugins() throws Exception {
        MycilaTesting mycilaTesting = MycilaTesting.from(new MycilaPlugins() {
            public Cache value() {
                return SHARED;
            }

            public String descriptor() {
                return MycilaTesting.DEFAULT_PLUGIN_DESCRIPTOR;
            }

            public Class<? extends Annotation> annotationType() {
                throw new AssertionError("should not go here");
            }
        });
        assertEquals(mycilaTesting.pluginManager().getCache().getBindings().size(), 2);
        assertTrue(mycilaTesting.pluginManager().getCache().contains("myplugin"));
        assertEquals(mycilaTesting, MycilaTesting.from(new MycilaPlugins() {
            public Cache value() {
                return SHARED;
            }

            public String descriptor() {
View Full Code Here

    @Test
    public void test_custom() throws Exception {
        MycilaTesting mycilaTesting = MycilaTesting.from(MycilaTestingTest.class);
        assertEquals(mycilaTesting.pluginManager().getCache().getBindings().size(), 0);
        mycilaTesting = MycilaTesting.from(new MycilaPlugins() {
            public Cache value() {
                return SHARED;
            }

            public String descriptor() {
                return "";
            }

            public Class<? extends Annotation> annotationType() {
                throw new AssertionError("should not go here");
            }
        });
        mycilaTesting.pluginManager().getCache().registerPlugin("aa", new MyPlugin());
        MycilaTesting mycilaTesting2 = MycilaTesting.from(new MycilaPlugins() {
            public Cache value() {
                return SHARED;
            }

            public String descriptor() {
View Full Code Here

    }

    @Test
    public void test_plugins_per_test() throws Exception {

        MycilaTesting mycilaTesting = MycilaTesting.from(new MycilaPlugins() {
            public Cache value() {
                return UNSHARED;
            }

            public String descriptor() {
                return "/plugins.properties";
            }

            public Class<? extends Annotation> annotationType() {
                throw new AssertionError("should not go here");
            }
        });
        assertEquals(mycilaTesting.pluginManager().getCache().getBindings().size(), 1);
        assertTrue(mycilaTesting.pluginManager().getCache().contains("myplugin"));
        ExtendedAssert.assertNotEquals(mycilaTesting, MycilaTesting.from(new MycilaPlugins() {
            public Cache value() {
                return UNSHARED;
            }

            public String descriptor() {
View Full Code Here

TOP

Related Classes of com.mycila.testing.core.annot.MycilaPlugins

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.