From 9aa0b339b6dee25ac37d151bf709e3ccb8bbb06b Mon Sep 17 00:00:00 2001 From: "ta.tanaka" Date: Tue, 26 Nov 2019 14:12:08 +0900 Subject: [PATCH] Add test. --- tests/src/test/scala/cats/tests/TrySuite.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/src/test/scala/cats/tests/TrySuite.scala b/tests/src/test/scala/cats/tests/TrySuite.scala index ef3d698c55..5aba43885d 100644 --- a/tests/src/test/scala/cats/tests/TrySuite.scala +++ b/tests/src/test/scala/cats/tests/TrySuite.scala @@ -72,6 +72,12 @@ class TrySuite extends CatsSuite { } } + test("catchOnly catches only a specified type") { + a[NumberFormatException] should be thrownBy { + MonadError[Try, Throwable].catchOnly[UnsupportedOperationException]("str".toInt) + } + } + test("fromTry works") { forAll { t: Try[Int] => (MonadError[Try, Throwable].fromTry(t)) should ===(t)