Hear us Roar
Article:
 |
|
Using Dependency Injection in Java EE 5.0
|
| Subject: |
|
So what's new ? |
| Date: |
|
2006-05-05 00:22:13 |
| From: |
|
pbpanther
|
Response to: So what's new ?
|
|
The difference between these 2 is unit testing the bean/servlet.
To test with an InitialContext you have to first set up a test context somehow then insert your mock/stub object into the the context.
With dependency injection there is no dependency on an InitialContext in your code, so all you have to do is inject your mock/stub implementation of HelloWorld and you are testing.
The reason for POJOs generally is so that you can unit test your code thoroughly and even program using TDD.
|
|
| |