Class and its test in different packages by default -> cannot access internal/protected members


The project created by atlas-create-confluence-plugin comes with the example class MyPluginComponentImpl that resides in some package, let’s say test.impl. Then, the integration test MyComponentWiredTest for the class is in the package it.test. So, as the class is in another package, package internal and protected members cannot be accessed.

As tests should be put into the same package as the tested class ( I moved MyComponentWiredTest to test.impl.

But then, when running the integration tests with atlas-integration-test I get the error:

test.impl.MyComponentWiredTest: the class [test.impl.MyComponentWiredTest] is annotated with @RunWith(AtlassianPluginsTestRunner.class) but it is not in the 'it.' package.(..)

How do you solve that? I don’t want to make everything public for testing. Of course I don’t want to move my implementation to it.test either.


Ok, I guess the way to go for unit testing is to remove the default packages and tests created by the atlas-create-*-plugin command and create the tests in the same package as the implementation.

That, at least, seems to be what happended in this tutorial:

The tutorials says to use the atlas-create-refapp-plugin command. Checking out stage4 of the bitbucket project, however, confirms that the default test package* is not used.

Still, I don’t know how to handle integration tests as they are expected to be in the it.* package…