Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Handler and JUnit test
Handler and JUnit test [message #481747] Mon, 24 August 2009 08:13 Go to next message
RCH is currently offline RCHFriend
Messages: 6
Registered: July 2009
Junior Member

First Thanks for reading this post.

I created an Handler class which deletes model elements from my tree
navigator. It semms to work well. Now I'm trying to write an integration
test for my Handler class. Therefore I used JUnit. I have basic knowledge
in JUnit but i never tested a Handler before. Wenn I start my test, i will
get a lot of NullPointExceptions.

For example that method in the class EMFTransactionPlugin causes an
Exception because getPlugin() returns null. public static String
getPluginId() {
return getPlugin().getBundle().getSymbolicName();
It is easy to understand because the whole UI interaction is missing in my
I created an test Handler which gets me the UI event but how can i
intergrate it in my Junit test?

Now my question.
How can I create an integration test for handlers unsing Junit? Can
somebody please help me, maybe there is a tutorial?

Thank you very much!

Re: Handler and JUnit test [message #481831 is a reply to message #481747] Mon, 24 August 2009 13:40 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

When dealing with plugins, you can create a Junit test (the manifest for your test plugin must depend on org.eclipse.junit). Then you can run your test as a Junit Plug-in Test so that OSGi runs and starts up the appropriate bundles.


Previous Topic:Core Expressions Debugging
Next Topic:Text encoding not picked up from container
Goto Forum:

Current Time: Sat Jun 23 14:32:07 GMT 2018

Powered by FUDForum. Page generated in 0.01527 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top