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
- Alphabetic
- By Inheritance
- TestRouteResult
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new TestRouteResult(_result: Future[RouteResult], awaitAtMost: FiniteDuration)(implicit ec: ExecutionContext, materializer: Materializer)
Concrete Value Members
- def assertContentType(expected: ContentType): TestRouteResult
Assert on the content type of the response.
- def assertContentType(expected: String): TestRouteResult
Assert on the content type of the response.
- def assertEntity(expected: String): TestRouteResult
Assert on the response entity to be a UTF8 representation of the given string.
- 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.
- def assertEntityBytes(expected: ByteString): TestRouteResult
Assert on the response entity to equal the given bytes.
- def assertHeaderExists(expected: HttpHeader): TestRouteResult
Assert that a given header instance exists in the response.
- def assertHeaderExists(name: String, value: String): TestRouteResult
Assert that a header of the given name and value exists.
- def assertHeaderKindExists(name: String): TestRouteResult
Assert that a header of the given type exists.
- def assertHeaderKindNotExists(name: String): TestRouteResult
Assert that a header of the given type does not exist.
- def assertMediaType(expected: MediaType): TestRouteResult
Assert on the media type of the response.
- def assertMediaType(expected: String): TestRouteResult
Assert on the media type of the response.
- def assertRejections(expectedRejections: Rejection*): TestRouteResult
- Annotations
- @varargs()
- def assertStatusCode(expected: StatusCode): TestRouteResult
Assert on the status code.
- def assertStatusCode(expected: Int): TestRouteResult
Assert on the numeric status code.
- def contentType: ContentType
Returns the response's content-type
- def contentTypeString: String
Returns a string representation of the response's content-type
- def entity[T](unmarshaller: Unmarshaller[HttpEntity, T]): T
Returns the entity of the response unmarshalled with the given
.Unmarshaller
- 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.
- def entityBytes: ByteString
Returns the bytes of the response entity
- def entityString: String
Returns the entity of the response interpreted as an UTF-8 encoded string.
- def header[T >: Null <: HttpHeader](clazz: Class[T]): T
Returns the first header of the response which is of the given class.
- def mediaType: MediaType
Returns the media-type of the response's content-type
- def mediaTypeString: String
Returns a string representation of the media-type of the response's content-type
- 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.
- 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.
- lazy val response: HttpResponse
Returns a copy of the underlying response with the strictified entity.
- def status: StatusCode
Returns the pekko.http.javadsl.model.StatusCode of the response.
- def statusCode: Int
Returns the numeric status code of the response.