final case class TestServer(driver: Driver, bindPort: Int) extends Server with Product with Serializable
Enables tests that make calls against "localhost" with user-specified Behavior/Responses.
- driver
The web driver that accepts our Server behavior
- bindPort
Port for HTTP interactions
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- TestServer
- Serializable
- Serializable
- Product
- Equals
- Server
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- All
Instance Constructors
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addHandler[R](pf: PartialFunction[Request, ZIO[R, Throwable, Response]]): ZIO[R, Nothing, Unit]
Add new behavior to Server
Add new behavior to Server
- pf
New behavior
for { state <- Ref.make(0) testRequest <- requestToCorrectPort _ <- TestServer.addHandler{ case (_: Request) => for { curState <- state.getAndUpdate(_ + 1) } yield { if (curState > 0) Response(Status.InternalServerError) else Response(Status.Ok) } }
Example: -
def
addRequestResponse(expectedRequest: Request, response: Response): ZIO[Any, Nothing, Unit]
Define 1-1 mappings between incoming Requests and outgoing Responses
Define 1-1 mappings between incoming Requests and outgoing Responses
- expectedRequest
Request that will trigger the provided Response
- response
Response that the Server will send
TestServer.addRequestResponse(Request.get(url = URL.root.setPort(port = ???)), Response(Status.Ok))
Example: -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- val bindPort: Int
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
- val driver: Driver
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
install[R](httpApp: App[R], errorCallback: Option[ErrorCallback])(implicit trace: Trace): URIO[R, Unit]
- Definition Classes
- TestServer → Server
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
port: Int
- Definition Classes
- TestServer → Server
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )