diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-12-20 13:32:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-20 13:32:02 +0100 |
commit | 246653f024c13ba0348fec3f83b147de11251fe3 (patch) | |
tree | 22f1a21ae2548f859817952421c0d25f98fa6ad8 /test/junit/scala/tools/testing/AssertUtil.scala | |
parent | 0924e7318046ea27a69c5f9d1675c9981f7ebeae (diff) | |
parent | 079e8dc61704a768792c6b210a5b0cd25522ee55 (diff) | |
download | scala-246653f024c13ba0348fec3f83b147de11251fe3.tar.gz scala-246653f024c13ba0348fec3f83b147de11251fe3.tar.bz2 scala-246653f024c13ba0348fec3f83b147de11251fe3.zip |
Merge pull request #5608 from retronym/merge/2.11.x-to-2.12.x-20161220
Merge 2.11.x to 2.12.x [ci: last-only]
Diffstat (limited to 'test/junit/scala/tools/testing/AssertUtil.scala')
-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) => } } |