I'm confused. I'm trying to test my entity bean.

I have:

- an entity bean
- a stateless session bean for accessing the entity bean (facade)
- an interface for accessing the the stateless bean

And I'm trying to write a JUnit test class to test this bean. However, I am 
uncertain as to how to test this (I'm new to EJB 3.0, JBoss and Eclipse).

What would the JUnit test look like? I'm confused as to whether or not I should 
be injecting the interface/bean/what???

I've tried several variations. I either get "NameNotFound" - not bound 
exceptions or Null pointer exceptions.

What would the @EJB syntax look like or how would I do it through the context?

For Example:

@EJB private TestFacade myTest; //interface to stateless bean ?

OR

InitialContext ctx = new InitialContext();
TestResultFacadeBean myTest = (TestResultFacadeBean) ctx.lookup("localTest");

I'm confused at to which method I should be using and what object I should be 
accessing. If I could get either one to work, I'd be happy. :)

If anyone has a simple example or explanation as to which method I should use 
and how to use it, I'd be very grateful.

Thanks very much,
LisaD

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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to