[GLASSFISH-19043] habitat is coming as null Created: 29/Aug/12 Updated: 11/Feb/13 Resolved: 11/Feb/13
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
When I tried to get the habitat it's coming as null during Junit test run.
Habitat habitat = Globals.getDefaultHabitat();
In normal scenario with server is up then there is no issue. i am getting habitat correctly.
|Comment by jwells [ 13/Dec/12 ]|
Is there a reproducer for this?
If you try to use Globals before the Habitat has been created then getDefaultHabitat will return null.
If you are doing unit testing with the new hk2 you might want to look into using the HK2Runner and simply inject the ServiceLocator into your test code.
If you think this truly should work, then provide a reproducer please. Thanks!