1 Reply Latest reply on Mar 1, 2010 9:46 PM by Allen Cunningham

    Events in unit test

    Allen Cunningham Newbie

      I added generation of a seam event to an existing method which causes this error in my unit test:

      No event context active
      at org.jboss.seam.Component.getInstance(Component.java:1999) 
      at org.jboss.seam.Component.getInstance(Component.java:1994) 
      at org.jboss.seam.Component.getInstance(Component.java:1967) 
      at org.jboss.seam.Component.getInstance(Component.java:1962) 
      at org.jboss.seam.core.Events.instance(Events.java:157) 
      at com.ols.cms.sas.SAS.icredit(SAS.java:50)

      Here is the code that generates the event:

      Events.instance().raiseEvent("transactionEvent", h.card, r);

      I am using Seam 2.2.0.GA. The code works fine when I run it in JBoss-5.1.0.GA. It works fine in unit test when I exclude the event generation.

      Do I need to do something to initialize the Event component or Context within a unit test?