Package com.netflix.governator.guice.mocks

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


        Injector    injector = lifecycleInjectorBuilder.createInjector();

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

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

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

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


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

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

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

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

TOP

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

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.