Examples of LazySingletonObject


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

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

        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
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.