Package com.github.jsr330.spi.config.builder

Examples of com.github.jsr330.spi.config.builder.BindingConditionsTest


        assertNull(container.getFactoryMethod());
    }
   
    @Test
    public void usingNonStaticMethodWithParameters() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).as(TestImplementation1.class)
                .using(factoryMethod(TestImplementation1.class, "instance4", String.class, String.class)).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertFalse(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
        assertNull(container.getConstructor());
View Full Code Here


        assertNull(container.getFactoryMethod());
    }
   
    @Test
    public void singletonUsingStaticFactoryMethodWithoutParameters() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).asSingleton(TestImplementation1.class)
                .using(factoryMethod(TestImplementation1.class)).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.FACTORY_METHOD, container.getInstanceMode());
        assertNull(container.getConstructor());
View Full Code Here

        assertEquals(factoryMethod(TestImplementation1.class), container.getFactoryMethod());
    }
   
    @Test
    public void singletonUsingStaticFactoryMethodWithParameters() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).asSingleton(TestImplementation1.class)
                .using(factoryMethod(TestImplementation1.class, String.class, String.class)).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.FACTORY_METHOD, container.getInstanceMode());
        assertNull(container.getConstructor());
View Full Code Here

        assertEquals(factoryMethod(TestImplementation1.class, String.class, String.class), container.getFactoryMethod());
    }
   
    @Test
    public void singletonUsingUnexistingMethod() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).asSingleton(TestImplementation1.class)
                .using(factoryMethod(TestImplementation1.class, String.class, Integer.class)).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
        assertNull(container.getConstructor());
View Full Code Here

        assertNull(container.getFactoryMethod());
    }
   
    @Test
    public void singletonUsingNamedStaticFactoryMethodWithoutParameters() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).asSingleton(TestImplementation1.class)
                .using(factoryMethod(TestImplementation1.class, "instance1")).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.FACTORY_METHOD, container.getInstanceMode());
        assertNull(container.getConstructor());
View Full Code Here

        assertEquals(factoryMethod(TestImplementation1.class, "instance1"), container.getFactoryMethod());
    }
   
    @Test
    public void singletonUsingNamedStaticFactoryMethodWithParameters() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).asSingleton(TestImplementation1.class)
                .using(factoryMethod(TestImplementation1.class, "instance2", String.class, String.class)).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.FACTORY_METHOD, container.getInstanceMode());
        assertNull(container.getConstructor());
View Full Code Here

        assertEquals(factoryMethod(TestImplementation1.class, "instance2", String.class, String.class), container.getFactoryMethod());
    }
   
    @Test
    public void singletonUsingUnexistingNamedMethodWithoutParameters() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).asSingleton(TestImplementation1.class)
                .using(factoryMethod(TestImplementation1.class, "instance123")).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
        assertNull(container.getConstructor());
View Full Code Here

        assertNull(container.getFactoryMethod());
    }
   
    @Test
    public void singletonUsingUnexistingNamedMethodWithParameters() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).asSingleton(TestImplementation1.class)
                .using(factoryMethod(TestImplementation1.class, "instance123", String.class, String.class)).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
        assertNull(container.getConstructor());
View Full Code Here

        assertNull(container.getFactoryMethod());
    }
   
    @Test
    public void singletonUsingNonStaticMethodWithoutParameters() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).asSingleton(TestImplementation1.class)
                .using(factoryMethod(TestImplementation1.class, "instance3")).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
        assertNull(container.getConstructor());
View Full Code Here

        assertNull(container.getFactoryMethod());
    }
   
    @Test
    public void singletonUsingNonStaticMethodWithParameters() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).asSingleton(TestImplementation1.class)
                .using(factoryMethod(TestImplementation1.class, "instance4", String.class, String.class)).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
        assertNull(container.getConstructor());
View Full Code Here

TOP

Related Classes of com.github.jsr330.spi.config.builder.BindingConditionsTest

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.