Package com.netflix.governator.guice.mocks

Examples of com.netflix.governator.guice.mocks.LazySingletonObject


            .createInjector();

        Assert.assertEquals(LazySingletonObject.constructorCount.get(), 0);
        Assert.assertEquals(LazySingletonObject.postConstructCount.get(), 0);

        LazySingletonObject instance = injector.getInstance(LazySingletonObject.class);
        Assert.assertEquals(LazySingletonObject.constructorCount.get(), 1);
        Assert.assertEquals(LazySingletonObject.postConstructCount.get(), 1);

        LazySingletonObject instance2 = injector.getInstance(LazySingletonObject.class);
        Assert.assertEquals(LazySingletonObject.constructorCount.get(), 1);
        Assert.assertEquals(LazySingletonObject.postConstructCount.get(), 1);

        Assert.assertSame(instance, instance2);
    }
View Full Code Here


        InjectedProvider injectedProvider = injector.getInstance(InjectedProvider.class);
        Assert.assertEquals(LazySingletonObject.constructorCount.get(), 0);
        Assert.assertEquals(LazySingletonObject.postConstructCount.get(), 0);

        LazySingletonObject instance = injectedProvider.provider.get();
        Assert.assertEquals(LazySingletonObject.constructorCount.get(), 1);
        Assert.assertEquals(LazySingletonObject.postConstructCount.get(), 1);

        LazySingletonObject instance2 = injectedProvider.provider.get();
        Assert.assertEquals(LazySingletonObject.constructorCount.get(), 1);
        Assert.assertEquals(LazySingletonObject.postConstructCount.get(), 1);

        Assert.assertSame(instance, instance2);
    }
View Full Code Here

TOP

Related Classes of com.netflix.governator.guice.mocks.LazySingletonObject

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.