Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] How to get the WorkbenchContext in a test

Hi,

In tests I think you can create the new EclipseContext instance with the new operator. Next you can create the new instance of your addon using this fake context with the ContextInjectionFactory class, like below:

IEclipseContext fakeContext = new EclipseContext(null);
YourAddon addon =  ContextInjectionFactory.make(YourAddon.class, fakeContext);

Obviously you have to add to the fakeContext all stuff that is needed by your addon. Following this way you get proper separation of the logic you want to test from the external components

thanks,
Daniel


On Wed, Jul 30, 2014 at 4:39 PM, Veselin Markov <veselin_m@xxxxxxxxxxx> wrote:
Hello,

I'm trying to test an Model-Addon that publishes an Object into the WorkbenchContext. I run my test as an plugin test and the addon sets the object in the workbenchContext. Now how do I acquire the workbenchContext so that I can check if the object is there?
I'm able to get the ServiceContext with EclipseContextFactory but there is no way to get its child-contexts. Is there an Toolkit that I can use? I appreciate any help.

Greetings
Veselin

_______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/e4-dev


Back to the top