diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-12-17 21:23:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-17 21:23:56 +0100 |
commit | 6cf2c046efd71ac5f0a1d9a2282259179043af8a (patch) | |
tree | 6de19f2802d7886df607636beece2e18e6a07951 /test | |
parent | bf54f1ff8e022043bbef31b19b574c760f5fe73e (diff) | |
parent | 97e8ee7f4360b6fbe284e3449d7f390b9b853b91 (diff) | |
download | scala-6cf2c046efd71ac5f0a1d9a2282259179043af8a.tar.gz scala-6cf2c046efd71ac5f0a1d9a2282259179043af8a.tar.bz2 scala-6cf2c046efd71ac5f0a1d9a2282259179043af8a.zip |
Merge pull request #5604 from sjrd/scalajs-friendly-assertthrows
Use ClassTag instead of Manifest in AssertUtil.assertThrows.
Diffstat (limited to 'test')
-rw-r--r-- | test/junit/scala/tools/testing/AssertUtil.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/test/junit/scala/tools/testing/AssertUtil.scala b/test/junit/scala/tools/testing/AssertUtil.scala index d798f2e53e..c9b2fb8e4d 100644 --- a/test/junit/scala/tools/testing/AssertUtil.scala +++ b/test/junit/scala/tools/testing/AssertUtil.scala @@ -3,6 +3,7 @@ package testing import org.junit.Assert import Assert._ +import scala.reflect.ClassTag import scala.runtime.ScalaRunTime.stringOf import scala.collection.{ GenIterable, IterableLike } import scala.collection.JavaConverters._ @@ -40,15 +41,13 @@ object AssertUtil { * and that its message satisfies the `checkMessage` predicate. * Any other exception is propagated. */ - def assertThrows[T <: Throwable](body: => Any, - checkMessage: String => Boolean = s => true) - (implicit manifest: Manifest[T]): Unit = { + def assertThrows[T <: Throwable: ClassTag](body: => Any, + checkMessage: String => Boolean = s => true): Unit = { try { body fail("Expression did not throw!") } catch { - case e: Throwable if (manifest.runtimeClass isAssignableFrom e.getClass) && - checkMessage(e.getMessage) => + case e: T if checkMessage(e.getMessage) => } } |