[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: Run As JUnit Plug-in Test


On 21/05/2008 15:23 Manuel Selva ha scritto:

Thanks for your answer. The problem is that the method throwing the exception is an Eclipse mathod and not my method. More accurately it's the IWorkbenchPage.showView method throwing a PartInitException (because I forgot to set the AllowMutiple field in my extension description) ...

You can test that method too, something like:

testCanOpenMultipleViews() {
  activePage.showView("primary", "secondary", VIEW_ACTIVATE);
}


Or, if showView is called from a more complex method, you can move the commands to a method that passes the exceptions upstream. For example, if it is contained in a Action.run method that catches the exception and display a dialog to the user, move the code inside the try/catch block to a method with the throws clause and test that method. The run method simply calls the new method inside the try/catch block.


Regards,
Marco.