Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I instantiate my test class from an ut.* package (for test console)?

Lars Raeder January 27, 2015

Hi,

I have a plugin class in src/main/java/com/example/impl/TargetImpl that implements the interface in src/main/java/com/example/api/TargetApi.

In my unit test in src/test/java/ut/com/example/TargetTest I use

TargetImpl x = new TargetImpl();

This works fine with atlas-unit-test, but when running it from the test console UI, I get java.lang.NoClassDefFoundError: com.example.impl.TargetImpl

What am I doing wrong? How can I make the OSGi container grant access to com.example.impl?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
LukasG March 11, 2015

Did you find a workaround or fix for this?

Lars Raeder March 11, 2015

Well, I use some bad hacking to work around it. It is probable too complicated. I set up a service in the test plugin. If the main plugin starts up and detects the presence of that service, it asks it about the objects that need to be instantiated by the test plugin and provides java.lang.reflect.Constructor objects for them. The tests can then ask the service for instances and they are created by the service using reflection.

Mateusz Szafarz June 2, 2015

Hi. Would it be a big problem for you to show me how exactly you did it? I have similar issue and I'm just curious.

TAGS
AUG Leaders

Atlassian Community Events