@@ -6,6 +6,8 @@ import org.scalatest.matchers.should.Matchers
6
6
import org .testcontainers .utility .DockerImageName
7
7
import sttp .client3 .{HttpURLConnectionBackend , UriContext , basicRequest }
8
8
9
+ import scala .util .Either
10
+
9
11
class RabbitMQSpec extends AnyFlatSpec with ForAllTestContainer with Matchers {
10
12
import RabbitMQSpec ._
11
13
@@ -21,7 +23,10 @@ class RabbitMQSpec extends AnyFlatSpec with ForAllTestContainer with Matchers {
21
23
.get(uri " $baseUri/ " )
22
24
23
25
val eitherContainerIsOnline =
24
- request.send(httpClientBackend).body.map(_ => true )
26
+ request.send(httpClientBackend).body match {
27
+ case Right (_) => Right (true )
28
+ case e@ Left (_) => e
29
+ }
25
30
26
31
assertResult(Right (true ))(eitherContainerIsOnline)
27
32
}
@@ -35,7 +40,10 @@ class RabbitMQSpec extends AnyFlatSpec with ForAllTestContainer with Matchers {
35
40
.get(uri " $baseUri/api/exchanges " )
36
41
37
42
val eitherExchangeWasLoaded =
38
- request.send(httpClientBackend).body.map(_.contains(testExchange))
43
+ request.send(httpClientBackend).body match {
44
+ case Right (v) => Right (v.contains(testExchange))
45
+ case e@ Left (_) => e
46
+ }
39
47
40
48
assertResult(Right (true ))(eitherExchangeWasLoaded)
41
49
}
@@ -47,10 +55,13 @@ class RabbitMQSpec extends AnyFlatSpec with ForAllTestContainer with Matchers {
47
55
.auth.basic(testUsername, testPassword)
48
56
.get(uri " $baseUri/api/users " )
49
57
50
- val eitheruserWasLoaded =
51
- request.send(httpClientBackend).body.map(_.contains(testUsername))
58
+ val eitherUserWasLoaded =
59
+ request.send(httpClientBackend).body match {
60
+ case Right (v) => Right (v.contains(testUsername))
61
+ case e@ Left (_) => e
62
+ }
52
63
53
- assertResult(Right (true ))(eitheruserWasLoaded )
64
+ assertResult(Right (true ))(eitherUserWasLoaded )
54
65
}
55
66
}
56
67
0 commit comments