Author: jjankovi
Date: 2012-04-03 08:32:47 -0400 (Tue, 03 Apr 2012)
New Revision: 39997
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/matcher/
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/matcher/StyledTextExistsInShellMatcher.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/matcher/TableExistsInShellMatcher.java
Log:
matcher package added into cdi bot test
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/matcher/StyledTextExistsInShellMatcher.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/matcher/StyledTextExistsInShellMatcher.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/matcher/StyledTextExistsInShellMatcher.java 2012-04-03
12:32:47 UTC (rev 39997)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.cdi.bot.test.matcher;
+
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.hamcrest.Description;
+import org.junit.internal.matchers.TypeSafeMatcher;
+
+@SuppressWarnings("restriction")
+public class StyledTextExistsInShellMatcher extends TypeSafeMatcher<SWTBotShell> {
+
+ public void describeTo(Description description) {
+ description.appendText("shell does not contain any " +
+ "styled text");
+ }
+
+ @Override
+ public boolean matchesSafely(SWTBotShell shell) {
+ try {
+ shell.bot().styledText();
+ return true;
+ } catch (WidgetNotFoundException exc) {
+ return false;
+ }
+ }
+
+}
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/matcher/TableExistsInShellMatcher.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/matcher/TableExistsInShellMatcher.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/matcher/TableExistsInShellMatcher.java 2012-04-03
12:32:47 UTC (rev 39997)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.cdi.bot.test.matcher;
+
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.hamcrest.Description;
+import org.junit.internal.matchers.TypeSafeMatcher;
+
+@SuppressWarnings("restriction")
+public class TableExistsInShellMatcher extends TypeSafeMatcher<SWTBotShell> {
+
+ public void describeTo(Description description) {
+ description.appendText("shell does not contain any " +
+ "table widget");
+ }
+
+ @Override
+ public boolean matchesSafely(SWTBotShell shell) {
+ try {
+ shell.bot().table();
+ return true;
+ } catch (WidgetNotFoundException exc) {
+ return false;
+ }
+ }
+
+}