Hello All,
I have very simple EJB3.0 session bean with no resource injection, no
reference to other Java EE component.
Without deploying EJB 3.0 to an appserver, I am still able to run my JUnit
test case for that session bean. I thought that until I deploy that bean,
call it using its JNDI reference name, I should not be able to access it.
But test is still working without deployment.
Can some one give an explanation what is going on?
EJB 3.0 session bean
import javax.ejb.Stateless;
import javax.ejb.*;
@Stateless
@Remote({CompanySessionLocal.class})
public class CompanySessionBean implements CompanySessionLocal {
public String helloWorld() {
String helloworld="Hello World";
return helloworld;
}
}
JUnit Test Case:
public class CompanySessionBeanTest {
public CompanySessionBeanTest() { }
@Test
public void helloWorld() {
System.out.println("helloWorld");
CompanySessionBean instance = new CompanySessionBean();
String expResult = "Hello World";
System.out.println("From bean-"+expResult);
String result = instance.helloWorld();
assertEquals(expResult, result);
}
Thanks,
Deepa