Author: lzoubek(a)redhat.com
Date: 2010-11-18 06:17:55 -0500 (Thu, 18 Nov 2010)
New Revision: 26701
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/Assertions.java
Log:
bot ext: added bot-related assertions hepler class
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/Assertions.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/Assertions.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/Assertions.java 2010-11-18
11:17:55 UTC (rev 26701)
@@ -0,0 +1,29 @@
+package org.jboss.tools.ui.bot.ext;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+
+public class Assertions {
+ /**
+ * asserts that given items are contained in tree (deep down)
+ * @param tree tree container
+ * @param items list of items that must be contatined
+ */
+ public static void assertTreeContent(SWTBotTree tree, String... items) {
+ assertTrue("Editor tree does not contain expected path of nodes : "
+ + Arrays.toString(items),
+ SWTEclipseExt.containstInTree(tree, items));
+ }
+ /**
+ * asserts that given control is enabled/disabled
+ * @param control given control
+ * @param enabled state - true for enabled, false for disabled
+ */
+ public static void assertControlEnabled(AbstractSWTBot<?> control, boolean
enabled) {
+ assertTrue(control.getClass().getSimpleName()+" "+control.getText()+ "
is not in state: isEnabled()="+enabled,enabled == control.isEnabled());
+ }
+}