Package com.inspiresoftware.lib.dto.geda.adapter

Examples of com.inspiresoftware.lib.dto.geda.adapter.ExtensibleBeanFactory


    }

    @Test
    public void testMapConstructor() throws Exception {

        final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(
                ClassLoaderBeanFactoryTest.class.getClassLoader(),
                new HashMap<String, String>() {{
                    put("myDto", DtoClass.class.getCanonicalName());
                    put("myEntity", EntityClass.class.getCanonicalName());
                }},
                new HashMap<String, String>() {{
                    put("myEntity", EntityInterface.class.getCanonicalName());
                }}
            );


        final Class myDtoClass = fb.getClazz("myDto");
        assertNotNull(myDtoClass);
        assertEquals(myDtoClass, DtoClass.class);

        final Object myDtoInstance = fb.get("myDto");
        assertNotNull(myDtoInstance);
        assertEquals(myDtoInstance.getClass(), DtoClass.class);

        final Class myEntityClass = fb.getClazz("myEntity");
        assertNotNull(myEntityClass);
        assertEquals(myEntityClass, EntityInterface.class);

        final Object myEntityInstance = fb.get("myEntity");
        assertNotNull(myEntityInstance);
        assertEquals(myEntityInstance.getClass(), EntityClass.class);

    }
View Full Code Here


public class ClassLoaderBeanFactoryTest {

    @Test
    public void testGetClazzNotFound() throws Exception {

        final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(ClassLoaderBeanFactoryTest.class.getClassLoader());

        final Class myDtoClass = fb.getClazz("myDto");
        assertNull(myDtoClass);

    }
View Full Code Here

    }

    @Test
    public void testGetNotFound() throws Exception {

        final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(ClassLoaderBeanFactoryTest.class.getClassLoader());

        final Object myDtoInstance = fb.get("myDto");
        assertNull(myDtoInstance);

    }
View Full Code Here

    }

    @Test
    public void testGetClazzNull() throws Exception {

        final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(ClassLoaderBeanFactoryTest.class.getClassLoader());

        final Class myDtoClass = fb.getClazz(null);
        assertNull(myDtoClass);

    }
View Full Code Here

    }

    @Test
    public void testGetClazzEmpty() throws Exception {

        final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(ClassLoaderBeanFactoryTest.class.getClassLoader());

        final Class myDtoClass = fb.getClazz(null);
        assertNull(myDtoClass);

    }
View Full Code Here

    }

    @Test
    public void testGetNull() throws Exception {

        final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(ClassLoaderBeanFactoryTest.class.getClassLoader());

        final Object myDtoInstance = fb.get(null);
        assertNull(myDtoInstance);

    }
View Full Code Here

    }

    @Test
    public void testGetEmpty() throws Exception {

        final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(ClassLoaderBeanFactoryTest.class.getClassLoader());

        final Object myDtoInstance = fb.get("");
        assertNull(myDtoInstance);

    }
View Full Code Here

    }

    @Test
    public void testRegisterDto() throws Exception {

        final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(ClassLoaderBeanFactoryTest.class.getClassLoader());

        fb.registerDto("myDto", DtoClass.class.getCanonicalName());

        final Class myDtoClass = fb.getClazz("myDto");
        assertNotNull(myDtoClass);
        assertEquals(myDtoClass, DtoClass.class);

        final Object myDtoInstance = fb.get("myDto");
        assertNotNull(myDtoInstance);
        assertEquals(myDtoInstance.getClass(), DtoClass.class);

    }
View Full Code Here

    }

    @Test(expected = IllegalArgumentException.class)
    public void testRegisterDtoNullKey() throws Exception {

        final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(ClassLoaderBeanFactoryTest.class.getClassLoader());

        fb.registerDto(null, DtoClass.class.getCanonicalName());

    }
View Full Code Here

    }

    @Test(expected = IllegalArgumentException.class)
    public void testRegisterDtoEmptyKey() throws Exception {

        final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(ClassLoaderBeanFactoryTest.class.getClassLoader());

        fb.registerDto("", DtoClass.class.getCanonicalName());

    }
View Full Code Here

TOP

Related Classes of com.inspiresoftware.lib.dto.geda.adapter.ExtensibleBeanFactory

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.