Method to assert that an exception is not thrown
authorGeorgios Gousios <gousiosg@gmail.com>
Tue, 10 Jan 2012 15:39:41 +0000 (17:39 +0200)
committerGeorgios Gousios <gousiosg@gmail.com>
Tue, 10 Jan 2012 16:17:52 +0000 (18:17 +0200)
src/test/scala/gr/grnet/aquarium/util/TestMethods.scala

index 2be8794..e27720c 100644 (file)
@@ -81,4 +81,12 @@ trait TestMethods {
       case Just(x) => fail("Operation not failed")
     }
   }
+
+  def assertNotThrows(f: => Unit): Unit = {
+    try {
+      f
+    } catch {
+      case e => fail("Exception %s was thrown".format(e))
+    }
+  }
 }
\ No newline at end of file