Packages

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

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TestServer
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Server
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TestServer(driver: Driver, bindPort: Int)

    driver

    The web driver that accepts our Server behavior

    bindPort

    Port for HTTP interactions

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addHandler[R](pf: PartialFunction[Request, ZIO[R, Response, Response]]): ZIO[R, Nothing, Unit]

    Add new behavior to Server

    Add new behavior to Server

    pf

    New behavior

    Example:
    1. 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)
          }
        }
  5. 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

    Example:
    1. TestServer.addRequestResponse(Request.get(url = URL.root.port(port = ???)), Response(Status.Ok))
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. val bindPort: Int
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @IntrinsicCandidate()
  9. val driver: Driver
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  12. def install[R](httpApp: HttpApp[R])(implicit trace: Trace): URIO[R, Unit]
    Definition Classes
    TestServer → Server
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  17. def port: Int
    Definition Classes
    TestServer → Server
  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  21. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Server

Inherited from AnyRef

Inherited from Any

Ungrouped