When it comes to testing Java EE applications, there’s a wide spectrum of tools and approaches at our disposal.
Depending on the specific goals and requirements of a given test, options range from
plain unit tests of single classes to comprehensive integration tests deployed into a container (e.g. via Arquillian)
and driven through tools such as REST Assured.
In this post I’d like to discuss one testing approach which represents some kind of a middle ground:
launching a local CDI container and a JPA runtime, connected to an in-memory database.
That way you can test CDI beans (e.g. containing business logic) in conjunction with the persistence layer (e.g. JPA-based repositories) under plain Java SE.