Integration Testing with Arquillian and Jira-Testkit: JAX-RS error

Hello everyone,

I’m developing a plugin for Jira Server and after the first feature is already partially finished, I started to implement an integration test using Arquillian. For the setup/teardown of the test I would like to use jira-testkit instead of injected services for simplicity. In this specific case I would like to create a new ApplicationLink, but when calling the method an error occurs because some JAX-RS service/dependency cannot be injected. Has anyone successfully set up Arquillian AND testkit together and has advice on how to configure it? I am specifically unsure about when I have to add Packages/Classes through the @BeforeDeployment annotation.

This is what the structure of my tests looks like:

@RunWith(Arquillian.class)
public class MyComponentTest {
    @Inject
    @ComponentImport
    MyComponent comp;

    @BeforeDeployment
    public static Archive<?> addToDeployment(JavaArchive archive) {
        return archive
            .addPackages(true, Backdoor.class.getPackage())
            .addPackages(true, "com/sun/jersey");
    }

    @Before
    public void setUp() {
        Backdoor testkit = new Backdoor(
            newTestkitLocalEnvironmentData(new Properties(), "./"));

       testkit.applicationLink().addApplicationLink(/*...*/);
    }

    @Test
    public void testMyComponent() {
        var result = this.comp.doSomething();
        assertTrue(result);
    }
}

On execution of the test with atlas-mvn test -Dtest=MyComponentTest everything works fine, until the following error occurs in the setUp() method, when I want to create the application link:

com.sun.jersey.spi.inject.Errors$ErrorMessagesException: "Missing dependency for constructor public com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App(com.sun.jersey.spi.inject.Injectable,javax.ws.rs.ext.Providers) at parameter index 0"

I appreciate any advice, also on integration testing for Jira plugins in general, as the official documentation seems to be pretty outdated.