Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Access to a WritableList
Access to a WritableList [message #502439] Tue, 08 December 2009 09:15 Go to next message
Tim  is currently offline Tim Friend
Messages: 12
Registered: December 2009
Junior Member

iam work with a tableviewer and a writablelist.
The writablelist contain the data for my viewer.

My Problem:
I work with swtbot and want access on the writablelist,
but i receive many exceptions :
"Getter called outside realm of ovservable .... WritableList"

I have solve this problem so:
UIThreadRunnable.syncExec(new VoidResult()
            public void run()
                assertEquals(bot.table().rowCount(), ModelProvider.getInstance().getInput().size());

Is this solution okay, or know some of you a better solution?

P.S. the ModelProvider is a Singleton which contain the WritableList. getInput() is the getter-Method for the WritableList

[Updated on: Tue, 08 December 2009 09:36]

Report message to a moderator

Re: Access to a WritableList [message #502751 is a reply to message #502439] Wed, 09 December 2009 15:45 Go to previous message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
The assert that executes in a uithreadrunnable is not really caught by junit. I'd recommend having the uithreadrunnable return an int and write an assert like you'd normally do.

In your case, I'd recommend writing the test like this:

public void testFoo (){
assertEquals(5, syncExec(new IntResult(){
public int run(){
// return the count

Also this seems more of a unit test to me that verifies the content provider. It might be cheaper to just new up a provider, shove in an input, and test the getElements() method Smile

-- Ketan
Previous Topic:2 menu item using 1 same name in a contextmenu
Next Topic:SWTBot
Goto Forum:

Current Time: Tue Apr 24 05:23:00 GMT 2018

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

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