Skip to content

TestingYourService

John Ament edited this page Aug 21, 2016 · 5 revisions

Testing your Hammock Service with Arquillian

Hammock provides an Arquillian extension, starting from the 0.2.0 release, that helps with your integration testing. You should obviously use your integration tests appropriately, following your own testing pyramid, but when it makes sense to use Arquillian and Hammock together, you can use the Hammock Arquillian Extension.

First, add the dependency:

<dependency>
    <groupId>ws.ament.hammock</groupId>
    <artifactId>test-arquillian</artifactId>
    <version>${hammock.version}</version>
    <scope>test</scope>
</dependency>

This will do two things for you:

  • Provide an Arquillian injection point for @ArquillianResource URI uri for your tests.
  • Add the necessary Hammock dependencies to your archive.

This means your archive for testing can be focused on only your needs, and can be as simple as (taken from the Microprofile canonical):

    @Deployment
    public static JavaArchive archive() {
        return ShrinkWrap.create(JavaArchive.class).addClasses(RestApplication.class, TopCDsEndpoint.class,
                        QLogger.class, ResourceProducer.class);
    }

Clone this wiki locally