[jboss-user] [JBoss Seam] - Null Pointer Exception During Integration Testing

neilac333 do-not-reply at jboss.com
Mon Dec 3 17:14:26 EST 2007


I am integration testing my first component, and I am finding a NullPointerException that I cannot find an explanation for.

Here is the class I am testing:

@Name("searchAction")
  | public final class searchAction extends Object {
  |    private String name;
  |    @In
  |    private SearchDelegate search;
  |    @Logger
  |    private Log logger;
  | 
  | ...and so on
  | 

Here is my test:

public void testSearchActionComponent() throws Exception {
  |       logger.debug("Starting method testSearchActionComponent");
  |       
  |       new ComponentTest() {
  | 
  |             protected void testComponents() throws Exception
  |             {
  |                setValue("#{searchAction.name}", "Benzoic");
  |             }
  | 
  |          }.run();
  |    }
  | 
  | 


Finally, here is the exception:


  | java.lang.NullPointerException
  | 	at org.jboss.seam.servlet.ServletApplicationMap.get(ServletApplicationMap.java:54)
  | 	at org.jboss.seam.contexts.BasicContext.get(BasicContext.java:48)
  | 	at org.jboss.seam.Component.getInstance(Component.java:1843)
  | 	at org.jboss.seam.Component.getInstance(Component.java:1821)
  | 	at org.jboss.seam.Component.getInstance(Component.java:1816)
  | 	at org.jboss.seam.core.Expressions.instance(Expressions.java:253)
  | 	at org.jboss.seam.mock.BaseSeamTest$ComponentTest.setValue(BaseSeamTest.java:160)
  | 	at model.test.SearchActionAdvancedTest$2.testComponents(Unknown Source)
  | 	at org.jboss.seam.mock.BaseSeamTest$ComponentTest.run(BaseSeamTest.java:170)
  | 	at model.test.SearchActionAdvancedTest.testComponent(Unknown Source)
  | 

As you can see, I am not really even testing anything.  I just wanted to see if this minimalist approach would pass, but it is not.

Please let me know if you need more information.  Any insight is appreciated.

Thanks.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110026#4110026

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110026



More information about the jboss-user mailing list