On 09-Oct-08, at 11:24 PM, mpauser wrote:

> ClassMatcher appears to have disappeared with the SWTBot 2.0 port  
> and I could
> not find a SWTBot replacement. Lines such as:
> List<Button> controls = new ChildrenControlFinder(dialog.widget)
>                    .findControls(new ClassMatcher(Button.class));
> can no longer compile. In looking at your javadocs it looks as if it  
> was
> replaced with org.hamcrest.Matcher.
>
> In 2.0, how would the above be rewritten to compile? I've added the
> hamcrest.jar to my Eclipse project but Matcher is an interface.


I'm still typing out a list of API that has changed.

In your case, you'll need to do a static import of  
WidgetMatcherFactory, I prefer adding it to the favorites under  
"Preferences>Java>Editor>Content Assist>Favorites" In addition I  
recommend adding the following as well: junit.framework.Assert,  
net.sf.swtbot.eclipse.finder.matcher.WidgetMatcherFactory,  
net.sf.swtbot.matcher.WidgetMatcherFactory,  
org.hamcrest.MatcherAssert, org.hamcrest.Matchers

The ClassMatcher is now replaced by the api widgetOfType(class). Take  
a look at the SWTBot class that has a lot of convenience API to see  
how it all works, it's just a few lines of code.

In your case your three lines of code will actually reduce to:

Button b = (Button) bot.widget(dialog.widget,  
widgetOfType(Button.class));

> Also, can you append a link to your CVS 2.0 source for your helpers  
> -- such
> as your 1.2 helper @
> http://swtbot.svn.sourceforge.net/svnroot/swtbot/trunk/net.sf.swtbot.eclipse.finder.test/src/net/sf/swtbot/eclipse/finder/widgets/helpers/PackageExplorerView.java
>  
> .

There's a lot of convenience API that's hidden away in the tests. If I  
make this API public, I'm sure that people will ask for a lot more.  
The bad thing about convenience API is that I need to maintain it : 
( I'm sure it should be possible to come up with a full blown  
complementary project with just convenience API.

-- Ketan

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
SWTBot-users mailing list
SWTBot-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse

Reply via email to