Testing internal classes in Eclipse

When writing a plug-in for eclipse, one can select which parts are public and visible for every plug-in (that will be the exposed API for extenders) or internal.

This is clearly a good idea. Consumers of you’re plug-in see only what they need, so they are saved from looking at the gory details.

However, you might like to test your internal API, which is usually done from a different plug-in… which won’t have access to the internal API that needs to be tested.

Is there a solution? Of course!

Expossing internal classes to a single plugin

What needs to be done is to export  the internal packages as if they where API, but change their visibility so only the test plug-in can see the classes.

Done! You can have a tested plug-in which a clear separation of public API and internal logic.



%d bloggers like this: