Packages

abstract class TestRouteResult extends AnyRef

A wrapper for route results.

To support the testkit API, a third-party testing library needs to implement this class and provide implementations for the abstract assertion methods.

Source
TestRouteResult.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TestRouteResult
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new TestRouteResult(_result: Future[RouteResult], awaitAtMost: FiniteDuration)(implicit ec: ExecutionContext, materializer: Materializer)

Concrete Value Members

  1. def assertContentType(expected: ContentType): TestRouteResult

    Assert on the content type of the response.

  2. def assertContentType(expected: String): TestRouteResult

    Assert on the content type of the response.

  3. def assertEntity(expected: String): TestRouteResult

    Assert on the response entity to be a UTF8 representation of the given string.

  4. def assertEntityAs[T <: AnyRef](unmarshaller: Unmarshaller[HttpEntity, T], expected: T): TestRouteResult

    Assert on the response entity to equal the given object after applying an pekko.http.javadsl.unmarshalling.Unmarshaller.

  5. def assertEntityBytes(expected: ByteString): TestRouteResult

    Assert on the response entity to equal the given bytes.

  6. def assertHeaderExists(expected: HttpHeader): TestRouteResult

    Assert that a given header instance exists in the response.

  7. def assertHeaderExists(name: String, value: String): TestRouteResult

    Assert that a header of the given name and value exists.

  8. def assertHeaderKindExists(name: String): TestRouteResult

    Assert that a header of the given type exists.

  9. def assertHeaderKindNotExists(name: String): TestRouteResult

    Assert that a header of the given type does not exist.

  10. def assertMediaType(expected: MediaType): TestRouteResult

    Assert on the media type of the response.

  11. def assertMediaType(expected: String): TestRouteResult

    Assert on the media type of the response.

  12. def assertRejections(expectedRejections: Rejection*): TestRouteResult
    Annotations
    @varargs()
  13. def assertStatusCode(expected: StatusCode): TestRouteResult

    Assert on the status code.

  14. def assertStatusCode(expected: Int): TestRouteResult

    Assert on the numeric status code.

  15. def contentType: ContentType

    Returns the response's content-type

  16. def contentTypeString: String

    Returns a string representation of the response's content-type

  17. def entity[T](unmarshaller: Unmarshaller[HttpEntity, T]): T

    Returns the entity of the response unmarshalled with the given Unmarshaller.

  18. lazy val entity: Strict

    Returns the strictified entity of the response.

    Returns the strictified entity of the response. It will be strictified on first access.

  19. def entityBytes: ByteString

    Returns the bytes of the response entity

  20. def entityString: String

    Returns the entity of the response interpreted as an UTF-8 encoded string.

  21. def header[T >: Null <: HttpHeader](clazz: Class[T]): T

    Returns the first header of the response which is of the given class.

  22. def mediaType: MediaType

    Returns the media-type of the response's content-type

  23. def mediaTypeString: String

    Returns a string representation of the media-type of the response's content-type

  24. def rejection: Rejection

    Expects the route to have been rejected with a single rejection.

    Expects the route to have been rejected with a single rejection. Fails the test if the route completes with a response, or is rejected with 0 or >1 rejections.

  25. def rejections: List[Rejection]

    Expects the route to have been rejected, returning the list of rejections, or empty list if the route was rejected with an empty rejection list.

    Expects the route to have been rejected, returning the list of rejections, or empty list if the route was rejected with an empty rejection list. Fails the test if the route completes with a response rather than having been rejected.

  26. lazy val response: HttpResponse

    Returns a copy of the underlying response with the strictified entity.

  27. def status: StatusCode

    Returns the pekko.http.javadsl.model.StatusCode of the response.

  28. def statusCode: Int

    Returns the numeric status code of the response.