cofactor
asked on
Stateless session bean
Stateless session bean using JPA for persistence are most thoroughly testable outside a container without requiring the creation of mock objects
I don't understand this .
It seems to me , this is impossible. Stateless session bean can not live outside container ...how come then we test ? Also Test without creating any objects of the bean !
This is impossible ...is not it ? Can we really do it ?
I don't understand this .
It seems to me , this is impossible. Stateless session bean can not live outside container ...how come then we test ? Also Test without creating any objects of the bean !
This is impossible ...is not it ? Can we really do it ?
It is just an annotated POJO so you don't need container to test.
ASKER
>>>It is just an annotated POJO
which one ?
Stateful session bean live in EJB container.
>>>so you don't need container to test.
How you are going to test that ?
jakarta Logger will not work unless you deploy .
System.out.println will not work unless you deploy .
Not sure about Junit / EJB3 Interceptor though
which one ?
Stateful session bean live in EJB container.
>>>so you don't need container to test.
How you are going to test that ?
jakarta Logger will not work unless you deploy .
System.out.println will not work unless you deploy .
Not sure about Junit / EJB3 Interceptor though
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yea...its better now.
Could you please explain this part in your comment
>>>Write unit test as you would normally do for POJOs
did you mean to use Assert ? if you mean something else please enlighten me....thanks
Could you please explain this part in your comment
>>>Write unit test as you would normally do for POJOs
did you mean to use Assert ? if you mean something else please enlighten me....thanks
Yes, normally you would use Asserts. Just usual unit test in which you instantiate your EJB classes as POJOs:
MyBean bean = new MyBeanImpl();
MyBean bean = new MyBeanImpl();
ASKER
ok..that looks pretty good.
but look it says "without requiring the creation of mock objects"
umm....does it make any sense ? what this could mean....is it meaningful ?
>>MyBean bean = new MyBeanImpl();
you are really creating instances here to test.
but look it says "without requiring the creation of mock objects"
umm....does it make any sense ? what this could mean....is it meaningful ?
>>MyBean bean = new MyBeanImpl();
you are really creating instances here to test.
Can you post the question in full ?
Yes, when you write a unit test, you are supposed to create the object you are testing ?
Yes, when you write a unit test, you are supposed to create the object you are testing ?