Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sttp is a family of Scala HTTP-related projects, and currently includes:
Add the following dependency:

```scala
"com.softwaremill.sttp.shared" %% "core" % "1.5.1"
"com.softwaremill.sttp.shared" %% "core" % "1.5.2"
```

sttp-shared is available for Scala 2.12, 2.13, 3.3, Scala.JS and Scala Native.
Expand Down
12 changes: 6 additions & 6 deletions core/src/test/scalajvm/sttp/monad/FutureMonadTest.scala
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package sttp.monad

import org.scalatest.concurrent.ScalaFutures.convertScalaFuture
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import org.scalatest.time.{Seconds, Span}

import java.util.concurrent.atomic.AtomicBoolean
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future

class FutureMonadTest extends AnyFlatSpec with Matchers {
class FutureMonadTest extends AnyFlatSpec with Matchers with ScalaFutures {
implicit override val patienceConfig: PatienceConfig = PatienceConfig(timeout = Span(10, Seconds))
implicit val m: MonadError[Future] = new FutureMonad()

it should "ensure" in {
val ran = new AtomicBoolean(false)

intercept[RuntimeException] {
m.ensure2((throw new RuntimeException("boom!")): Future[Int], Future(ran.set(true))).futureValue
}

val result = m.ensure2((throw new RuntimeException("boom!")): Future[Int], Future(ran.set(true)))
result.failed.futureValue shouldBe a[RuntimeException]
ran.get shouldBe true
}
}
Loading