Chapter 15. Testing and EJB
This chapter covers
- Different testing strategies
- Unit testing EJBs
- Integration testing EJBs with the embedded EJBContainer
- Integration testing EJBs with Arquillian
- Using CDI in tests
In the previous chapters, we’ve focused on learning the different technologies EJB 3 has to offer and showcasing examples of those technologies so you understand how to use them and apply them in your own applications. But now that you know how to use the technologies, how do you guarantee they’re going to fulfill your business requirements, operate securely and accurately, and give a positive user experience? You do this with testing.
This chapter covers some of the basics of testing EJB technologies. We’ll start by discussing what the different testing strategies are and how they fit into testing EJBs. Next, we’ll look at using technologies such as the embedded EJBContainer and Arquillian for more real-world tests. Finally, we’ll present some common testing problems to avoid so your testing can be more effective. Let’s start by introducing testing.