new ComponentTest()
{
@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();
}