Package org.jboss.seam.example.guice

Examples of org.jboss.seam.example.guice.Juice


         @Override
         protected void testComponents() throws Exception
         {
            JuiceBar juiceBar = (JuiceBar) getInstance("juiceBar");

            Juice juiceOfTheDay = juiceBar.getJuiceOfTheDay();
            assert "Apple Juice".equals(juiceOfTheDay.getName()) : juiceOfTheDay.getName();
            Juice anotherJuice = juiceBar.getAnotherJuice();
            assert "Orange Juice".equals(anotherJuice.getName()) : anotherJuice.getName();

            Juice juiceOfTheDay2 = juiceBar.getJuiceOfTheDay();
            assert juiceOfTheDay != juiceOfTheDay2 : "A new instance should be created by Guice.";
            Juice anotherJuice2 = juiceBar.getAnotherJuice();
            assert anotherJuice == anotherJuice2 : "Different instances returned for the singleton object.";
         }
      }.run();
   }
View Full Code Here

TOP

Related Classes of org.jboss.seam.example.guice.Juice

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.