Oh no… this causes the following (cryptic) message:
java.lang.IllegalStateException: ComponentAccessor has not been initialised.
This is not expected to occur on a production system.
Developers that encounter this message within a unit test
should use n MockitoMocksInContainer rule to initialize mockito and ComponentAccessor.
For more detailed explanation read the documentation
for MockComponentWorker in the jira-tests artifact for more information
about what causes this error and how to address it.
I’m sure that is very clear for those who have done this before - unfortunately I’ve never done this… So I’m assuming we are using Mockito here to mock out the interface, but I’m going to have to try and find an example of how to actually use it…
Also not sure that ComponentAccessor is the right approach - any other ways to do this?
Not sure why you are getting Illigal State Exception when using the Component Accessor, but instead of using the Component Accessor, you could try using Component Imports.
If you created a plugin from atlas-create-jira-plugin (Spring Scanner 1 if im not mistaken), you will need to add component-import plugin modules to your plugin descriptor and then use it in your own class constructor.
Otherwise, you can use Spring scanner 2 which allows the use of Component Import and Autowire / Inject annotations.