org.eclipse.swtbot.swt.finder
Class SWTBotAssert

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.SWTBotAssert

public abstract class SWTBotAssert
extends Object

The SWTBotAssert provides extra capabilities for comparing widgets and other UI items. A set of assert methods. Messages are only displayed when an assert fails. See Assert

Since:
2.0
Version:
$Id$
Author:
Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>

Constructor Summary
SWTBotAssert()
           
 
Method Summary
static void assertContains(String needle, String hayStack)
          Asserts that the needle is contained within the hayStack.
static void assertDoesNotContain(String needle, String hayStack)
          Asserts that the needle is not present in the hayStack.
static void assertEnabled(AbstractSWTBot<? extends Widget> widget)
          Asserts that the widget is enabled.
static void assertMatchesRegex(String regex, AbstractSWTBot<? extends Widget> actual)
          Assert that the widget text matches the regex.
static void assertMatchesRegex(String regex, String actual)
          Assert that the widget text matches the regex.
static void assertMatchesRegex(String regex, Widget actual)
          Assert that the widget text matches the regex.
static void assertNotEnabled(AbstractSWTBot<? extends Widget> widget)
          Asserts that the widget is not enabled.
static void assertNotSameWidget(String message, Widget expected, Widget actual)
          Asserts the two widgets do not refer to the same object.
static void assertNotSameWidget(Widget expected, Widget actual)
          Asserts that two widgets do not refer to the same object.
static void assertNotVisible(AbstractSWTBot<? extends Widget> widget)
          Asserts that the widget is not visible.
static void assertSameWidget(String message, Widget expected, Widget actual)
          Asserts that two widgets refer to the same widgets.
static void assertSameWidget(Widget expected, Widget actual)
          Asserts that two widgets refer to the same widget.
static void assertText(String expected, AbstractSWTBot<? extends Widget> widget)
          Assert that the given string is the same as the widgets text.
static void assertText(String expected, Widget widget)
          Assert that the given string is the same as the widgets text.
static void assertTextContains(String expected, AbstractSWTBot<? extends Widget> widget)
          Assert that the text on the widget contains the expected text.
static void assertTextContains(String expected, Widget widget)
          Assert that the text on the widget contains the expected text.
static void assertTextDoesNotContain(String expected, AbstractSWTBot<? extends Widget> widget)
          Assert that the text on the widget does not contain the expected text.
static void assertTextDoesNotContain(String expected, Widget widget)
          Assert that the text on the widget does not contain the expected text.
static void assertVisible(AbstractSWTBot<? extends Widget> widget)
          Asserts that the widget is visible.
static void pass()
          A helper to explicitly convey that the test has passed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWTBotAssert

public SWTBotAssert()
Method Detail

assertNotSameWidget

public static void assertNotSameWidget(Widget expected,
                                       Widget actual)
Asserts that two widgets do not refer to the same object.

Parameters:
expected - the object you don't expect
actual - the object to compare to unexpected
See Also:
Assert#assertNotSame(String, Object, Object)

assertNotSameWidget

public static void assertNotSameWidget(String message,
                                       Widget expected,
                                       Widget actual)
Asserts the two widgets do not refer to the same object. The message will be used if the test fails.

Parameters:
message - the identifying message or null for the AssertionError
expected - the object you don't expect
actual - the object to compare to unexpected

assertContains

public static void assertContains(String needle,
                                  String hayStack)
Asserts that the needle is contained within the hayStack.

Parameters:
needle - the text to search in the hayStack.
hayStack - the text to look within.

assertDoesNotContain

public static void assertDoesNotContain(String needle,
                                        String hayStack)
Asserts that the needle is not present in the hayStack.

Parameters:
needle - the text to search in the hayStack.
hayStack - the text to look within.

assertSameWidget

public static void assertSameWidget(Widget expected,
                                    Widget actual)
Asserts that two widgets refer to the same widget.

Parameters:
expected - the expected widget
actual - the widget to compare to expected

assertSameWidget

public static void assertSameWidget(String message,
                                    Widget expected,
                                    Widget actual)
Asserts that two widgets refer to the same widgets.

Parameters:
message - the identifying message or null for the AssertionError
expected - the expected widget
actual - the widget to compare to expected

pass

public static void pass()
A helper to explicitly convey that the test has passed. Does nothing.


assertText

public static void assertText(String expected,
                              Widget widget)
Assert that the given string is the same as the widgets text.

Parameters:
expected - the expected text
widget - the widget to get the text from to compare.

assertText

public static void assertText(String expected,
                              AbstractSWTBot<? extends Widget> widget)
Assert that the given string is the same as the widgets text.

Parameters:
expected - the expected text
widget - the widget to get the text from to compare.

assertTextContains

public static void assertTextContains(String expected,
                                      Widget widget)
Assert that the text on the widget contains the expected text.

Parameters:
expected - the expected text.
widget - the widget

assertTextContains

public static void assertTextContains(String expected,
                                      AbstractSWTBot<? extends Widget> widget)
Assert that the text on the widget contains the expected text.

Parameters:
expected - the expected text
widget - the widget

assertTextDoesNotContain

public static void assertTextDoesNotContain(String expected,
                                            Widget widget)
Assert that the text on the widget does not contain the expected text.

Parameters:
expected - the expected text
widget - the widget

assertTextDoesNotContain

public static void assertTextDoesNotContain(String expected,
                                            AbstractSWTBot<? extends Widget> widget)
Assert that the text on the widget does not contain the expected text.

Parameters:
expected - the expected text
widget - the widget

assertEnabled

public static void assertEnabled(AbstractSWTBot<? extends Widget> widget)
Asserts that the widget is enabled.

Parameters:
widget - the widget.

assertNotEnabled

public static void assertNotEnabled(AbstractSWTBot<? extends Widget> widget)
Asserts that the widget is not enabled.

Parameters:
widget - the widget.

assertVisible

public static void assertVisible(AbstractSWTBot<? extends Widget> widget)
Asserts that the widget is visible.

Parameters:
widget - the widget.

assertNotVisible

public static void assertNotVisible(AbstractSWTBot<? extends Widget> widget)
Asserts that the widget is not visible.

Parameters:
widget - the widget.

assertMatchesRegex

public static void assertMatchesRegex(String regex,
                                      AbstractSWTBot<? extends Widget> actual)
Assert that the widget text matches the regex.

Parameters:
regex - the regex.
actual - the widget.

assertMatchesRegex

public static void assertMatchesRegex(String regex,
                                      Widget actual)
Assert that the widget text matches the regex.

Parameters:
regex - the regex.
actual - the widget.

assertMatchesRegex

public static void assertMatchesRegex(String regex,
                                      String actual)
Assert that the widget text matches the regex.

Parameters:
regex - the regex.
actual - the widget.