4 Replies Latest reply on Dec 31, 2007 2:15 AM by Berkay Aktan

    injection in tests ?

    Berkay Aktan Newbie

      Want to test my action classes with hibernateSession instead of EntityManager and my actions like below..

      private Session hibernateSession;
      @Out @In(required=false)
      Category category;
      public String save(){
       //bla bla
       return "success";

      when i want to test this action with testNG, hibernate session doesnt initialize..

       public void testAddCategory() throws Exception {
       Category cat = new Category();
       CategoryAction action = new CategoryAction();
       assert "categoryTree".equals(action.save());//throws nullpointer because of the not initialized hibernate session

      and according to me seam doesn't works while testing because Logger and In annotation doesnt works either..
      All the examples are about EntityManagerFactory & EntityManager..

      How can i find a solution for this test case with hibernate session ??