Testing a Java EE Container with Mockito and Arquillian

The testing strategy to adopt when you you run your code inside a Java EE container is the topic discussed in this blog post by Antonio Goncalves. To solve this issue, he presents a detailed step by step process to unit test an EJB with Mockito and how to do integration test with and without Arquillian with code samples. His conclusion is that since Java EE 6 it is now easy to use container and services in an embedded mode. Unit testing is good to test business code or code in isolation (mocking external components) but you have to remember that you should also use integration testing to test code interacting with external components or services.