Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » JUnit test case for a method which has a Job(How do i write JUnit test case for a method which uses Job)
JUnit test case for a method which has a Job [message #660164] Thu, 17 March 2011 07:54 Go to next message
Saurabh Mising name is currently offline Saurabh Mising nameFriend
Messages: 21
Registered: October 2010
Junior Member
I have a method which is run in the main thread. I start an Eclipse Non-UI job. IN the job, we make a server call. On the job done event, we want to jump on to the main thread.
How do I write a JUnit test case which will test a methods which uses Jobs?
Re: JUnit test case for a method which has a Job [message #663057 is a reply to message #660164] Sat, 02 April 2011 20:57 Go to previous message
Richard Adams is currently offline Richard AdamsFriend
Messages: 77
Registered: July 2009
Location: Edinburgh
Member
I'd suggest that you might need to refactor your class. If you want to run a Junit test for this method, stub the job and override the threading, and concentrate on testing the pre & post-conditions of the method. Refactor the server calls into a separate class test that independently. That enables you to reuse that code outside of an Eclipse Job as well.

Best wishes

Richard


Previous Topic:get Place holder of a views
Next Topic:Fold view
Goto Forum:
  


Current Time: Fri Dec 19 13:09:25 GMT 2014

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

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