[jbosstools-commits] JBoss Tools SVN: r42890 - trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Aug 7 15:39:42 EDT 2012


Author: vpakan at redhat.com
Date: 2012-08-07 15:39:42 -0400 (Tue, 07 Aug 2012)
New Revision: 42890

Modified:
   trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java
Log:
Add methods to not report exceptions in Eclipse log as test failure.

Modified: trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java	2012-08-07 17:07:08 UTC (rev 42889)
+++ trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java	2012-08-07 19:39:42 UTC (rev 42890)
@@ -3,6 +3,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Properties;
 
@@ -35,6 +36,7 @@
 	protected SWTJBTBot bot = new SWTJBTBot();
 	private static int sleepTime = 1000;
 	private Logger log = Logger.getLogger(JBTSWTBotTestCase.class);
+	private HashSet<String> ignoredExceptionsFromEclipseLog = new HashSet<String>();
 	/*
 	 * (non-Javadoc) This static block read properties from
 	 * org.jboss.tools.ui.bot.test/resources/SWTBot.properties file and set up
@@ -77,6 +79,12 @@
 				throwable = new Throwable(status.getMessage() + " in " //$NON-NLS-1$
 						+ status.getPlugin());
 			}
+			else {
+		     // Check if exception has to be ignored
+         if (ignoredExceptionsFromEclipseLog.contains(throwable.getClass().getCanonicalName())){
+           throwable = null;
+         }
+			}
 			setException(throwable);
 			break;
 		default:
@@ -388,4 +396,26 @@
         (areThereNoErrors ? "" : errors[0].getText()),
       areThereNoErrors);
 	}
+	/**
+	 * Adds exceptionFullClassName to ignored exception from eclipse log
+	 * exceptionFullClassName exception will not make test failing
+	 * @param exceptionFullClassName
+	 */
+	protected void addIgnoredExceptionFromEclipseLog(String exceptionFullClassName){
+	  ignoredExceptionsFromEclipseLog.add(exceptionFullClassName);
+	}
+	/**
+	 * Removes exceptionFullClassName from ignored exception from eclipse log
+	 * exceptionFullClassName exception will make test failing
+	 * @param exceptionFullClassName
+	 */
+  protected void removeIgnoredExceptionFromEclipseLog(String exceptionFullClassName){
+    ignoredExceptionsFromEclipseLog.remove(exceptionFullClassName);
+  }
+  /**
+   * Removes all ignored exceptions
+   */
+  protected void eraseIgnoredExceptionsFromEclipseLog(){
+    ignoredExceptionsFromEclipseLog.clear();
+  }
 }



More information about the jbosstools-commits mailing list