3 Replies Latest reply on May 29, 2009 12:54 PM by Paul Keogh

    Null log inside EntityQuery while testing with TestNG

    Ivan B Novice

      Hi,


      How can one setup getLog() working with TestNG? I've got the problem that getLog() doesn't return the actual logger, and that breaks testing with NPE.


      Here is the component I'd like to test:


      @Name("regionList")
      public class RegionList extends EntityQuery<Region>
      {
          public RegionList()
          {
              setEjbql("select region from Region region");
          }
      
          @Override
          public List<Region> getResultList() {
              List<Region> regionList = super.getResultList();
      
              //## Here it breaks in testNG ##
              getLog().warn("Size is #0", regionList.size()); 
      
              return regionList;
          }
      



      The test class for the component:


      public class RegionListTest extends SeamTest {
      
          @Test
          public void testGetRegions() throws Exception {
              new ComponentTest() {
                  protected void testComponents() throws Exception {
                      RegionList regionList = new RegionList();
                      List<Region> resultList = regionList.getResultList();
                      for (Region region : resultList) {
                          System.out.println("region = " + region.getFullName());
                      }
                  }
              }.run();
          }
      }
      



      Any advice is appreciated,
      Ivan