Java Reference
In-Depth Information
ShrinkWrap Resolver
In almost every Arquillian test, you will probably use ShrinkWrap to create micro deploy-
ments. After working with it for a bit, you will probably notice some shortcomings. You
might be wondering what happens when you've got a test that relies on some external lib-
rary; do you need to add all packages from that library? The answer is no. ShrinkWrap
Resolver offers integration with Maven and basic Gradle support is also available. You can
just write in your test what dependency you'd like to include in the archive and it will be
deployed with the micro deployment.
Let's look at the basic example of the ShrinkWrap Resolver Maven integration:
The preceding line means that we want to resolve an artifact with the given group ID, arti-
fact ID, and version (Maven coordinates in canonical form) from Maven's central reposit-
ory with all its dependencies, and convert it to a list of files.
However, with this example, you have to maintain the artifact version both in the test code
and build file. You can improve this! Just import some dependencies data from your
pom.xml file, so that ShrinkWrap Resolver resolves artifacts of the same versions the
main project is using:
So now, first of all, the pom.xml data is loaded, including all depending management sec-
tions and artifacts versions. Also, the artifact coordinates do not have to include the ver-
These are the most basic features. You can fully configure the resolver manually, the repos-
itories you want to use, Maven profiles to be applied, and much more. Let's now grab an
Let's say you're testing your project using JUnit and some fancy assertion library. AssertJ
(successor of FEST assertions) is a fluent assertions library that allows you to write your
project in a more human-readable form:
Search WWH ::

Custom Search