Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.0_b51
    • Fix Version/s: None
    • Component/s: hk2
    • Labels:
      None
    • Environment:

      all

      Description

      When I tried to get the habitat it's coming as null during Junit test run.

      Habitat habitat = Globals.getDefaultHabitat();
      if(habitat == null) return;

      In normal scenario with server is up then there is no issue. i am getting habitat correctly.

        Activity

        naman_mehta created issue -
        shreedhar_ganapathy made changes -
        Field Original Value New Value
        Assignee shreedhar_ganapathy [ shreedhar_ganapathy ] jwells [ jwells ]
        Hide
        jwells added a comment -

        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!

        Show
        jwells added a comment - 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!
        jwells made changes -
        Assignee jwells [ jwells ] naman_mehta [ naman_mehta ]
        naman_mehta made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Cannot Reproduce [ 5 ]

          People

          • Assignee:
            naman_mehta
            Reporter:
            naman_mehta
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: