Class TestRouteResult
java.lang.Object
org.apache.pekko.http.javadsl.testkit.TestRouteResult
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.
- 
Constructor SummaryConstructorsConstructorDescriptionTestRouteResult(scala.concurrent.Future<RouteResult> _result, scala.concurrent.duration.FiniteDuration awaitAtMost, scala.concurrent.ExecutionContext ec, org.apache.pekko.stream.Materializer materializer) 
- 
Method SummaryModifier and TypeMethodDescriptionassertContentType(String expected) Assert on the content type of the response.assertContentType(ContentType expected) Assert on the content type of the response.assertEntity(String expected) Assert on the response entity to be a UTF8 representation of the given string.<T> TestRouteResultassertEntityAs(Unmarshaller<HttpEntity, T> unmarshaller, T expected) Assert on the response entity to equal the given object after applying anpekko.http.javadsl.unmarshalling.Unmarshaller.assertEntityBytes(org.apache.pekko.util.ByteString expected) Assert on the response entity to equal the given bytes.protected abstract voidassertEquals(int expected, int actual, String message) protected abstract voidassertEquals(Object expected, Object actual, String message) protected TestRouteResultassertEqualsKind(int expected, int actual, String kind) protected TestRouteResultassertEqualsKind(Object expected, Object actual, String kind) assertHeaderExists(String name, String value) Assert that a header of the given name and value exists.assertHeaderExists(HttpHeader expected) Assert that a given header instance exists in the response.assertHeaderKindExists(String name) Assert that a header of the given type exists.Assert that a header of the given type does not exist.assertMediaType(String expected) Assert on the media type of the response.assertMediaType(MediaType expected) Assert on the media type of the response.assertRejections(Rejection... expectedRejections) Assert that a given header instance exists in the response.assertRejections(scala.collection.immutable.Seq<Rejection> expectedRejections) assertStatusCode(int expected) Assert on the numeric status code.assertStatusCode(StatusCode expected) Assert on the status code.protected abstract voidassertTrue(boolean predicate, String message) Returns the response's content-typeReturns a string representation of the response's content-typeentity()<T> Tentity(Unmarshaller<HttpEntity, T> unmarshaller) Returns the entity of the response unmarshalled with the givenUnmarshaller.org.apache.pekko.util.ByteStringReturns the bytes of the response entityReturns the entity of the response interpreted as an UTF-8 encoded string.protected abstract void<T extends HttpHeader>
 TReturns the first header of the response which is of the given class.Returns the media-type of the response's content-typeReturns a string representation of the media-type of the response's content-typeExpects the route to have been rejected with a single 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.response()status()Returns thepekko.http.javadsl.model.StatusCodeof the response.intReturns the numeric status code of the response.
- 
Constructor Details- 
TestRouteResultpublic TestRouteResult(scala.concurrent.Future<RouteResult> _result, scala.concurrent.duration.FiniteDuration awaitAtMost, scala.concurrent.ExecutionContext ec, org.apache.pekko.stream.Materializer materializer) 
 
- 
- 
Method Details- 
assertContentTypeAssert on the content type of the response.- Parameters:
- expected- (undocumented)
- Returns:
- (undocumented)
 
- 
assertContentTypeAssert on the content type of the response.- Parameters:
- expected- (undocumented)
- Returns:
- (undocumented)
 
- 
assertEntityAssert on the response entity to be a UTF8 representation of the given string.- Parameters:
- expected- (undocumented)
- Returns:
- (undocumented)
 
- 
assertEntityAsAssert on the response entity to equal the given object after applying anpekko.http.javadsl.unmarshalling.Unmarshaller.- Parameters:
- unmarshaller- (undocumented)
- expected- (undocumented)
- Returns:
- (undocumented)
 
- 
assertEntityBytesAssert on the response entity to equal the given bytes.- Parameters:
- expected- (undocumented)
- Returns:
- (undocumented)
 
- 
assertEquals
- 
assertEquals
- 
assertEqualsKind
- 
assertEqualsKind
- 
assertHeaderExistsAssert that a header of the given name and value exists.- Parameters:
- name- (undocumented)
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
assertHeaderExistsAssert that a given header instance exists in the response.- Parameters:
- expected- (undocumented)
- Returns:
- (undocumented)
 
- 
assertHeaderKindExistsAssert that a header of the given type exists.- Parameters:
- name- (undocumented)
- Returns:
- (undocumented)
 
- 
assertHeaderKindNotExistsAssert that a header of the given type does not exist.- Parameters:
- name- (undocumented)
- Returns:
- (undocumented)
 
- 
assertMediaTypeAssert on the media type of the response.- Parameters:
- expected- (undocumented)
- Returns:
- (undocumented)
 
- 
assertMediaTypeAssert on the media type of the response.- Parameters:
- expected- (undocumented)
- Returns:
- (undocumented)
 
- 
assertRejectionsAssert that a given header instance exists in the response.- Parameters:
- expectedRejections- (undocumented)
- Returns:
- (undocumented)
 
- 
assertRejectionspublic TestRouteResult assertRejections(scala.collection.immutable.Seq<Rejection> expectedRejections) 
- 
assertStatusCodeAssert on the numeric status code.- Parameters:
- expected- (undocumented)
- Returns:
- (undocumented)
 
- 
assertStatusCodeAssert on the status code.- Parameters:
- expected- (undocumented)
- Returns:
- (undocumented)
 
- 
assertTrue
- 
contentTypeReturns the response's content-type- Returns:
- (undocumented)
 
- 
contentTypeStringReturns a string representation of the response's content-type- Returns:
- (undocumented)
 
- 
entity
- 
entityReturns the entity of the response unmarshalled with the givenUnmarshaller.- Parameters:
- unmarshaller- (undocumented)
- Returns:
- (undocumented)
 
- 
entityBytespublic org.apache.pekko.util.ByteString entityBytes()Returns the bytes of the response entity- Returns:
- (undocumented)
 
- 
entityStringReturns the entity of the response interpreted as an UTF-8 encoded string.- Returns:
- (undocumented)
 
- 
fail
- 
headerReturns the first header of the response which is of the given class.- Parameters:
- clazz- (undocumented)
- Returns:
- (undocumented)
 
- 
mediaTypeReturns the media-type of the response's content-type- Returns:
- (undocumented)
 
- 
mediaTypeStringReturns a string representation of the media-type of the response's content-type- Returns:
- (undocumented)
 
- 
rejectionExpects 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.- Returns:
- (undocumented)
 
- 
rejectionsExpects 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.- Returns:
- (undocumented)
 
- 
response
- 
statusReturns thepekko.http.javadsl.model.StatusCodeof the response.- Returns:
- (undocumented)
 
- 
statusCodepublic int statusCode()Returns the numeric status code of the response.- Returns:
- (undocumented)
 
 
-