Skip to content

Commit

Permalink
=htt #5 assertHeaderExists functions now behave in the same way
Browse files Browse the repository at this point in the history
Information about missing header name or values not matching assertion are logged.
  • Loading branch information
rbudzko authored and aruediger committed Sep 20, 2016
1 parent c2e71d3 commit 73d4f72
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,6 @@ abstract class TestRouteResult(_result: RouteResult, awaitAtMost: FiniteDuration
def assertEntityAs[T <: AnyRef](unmarshaller: Unmarshaller[HttpEntity, T], expected: T): TestRouteResult =
assertEqualsKind(expected, entity(unmarshaller), "entity")

/**
* Assert that a given header instance exists in the response.
*/
def assertHeaderExists(expected: HttpHeader): TestRouteResult = {
assertTrue(response.headers.exists(_ == expected), s"Header $expected was missing.")
this
}

/**
* Assert that a header of the given type exists.
*/
Expand Down Expand Up @@ -217,6 +209,12 @@ abstract class TestRouteResult(_result: RouteResult, awaitAtMost: FiniteDuration
this
}

/**
* Assert that a given header instance exists in the response.
*/
def assertHeaderExists(expected: HttpHeader): TestRouteResult =
assertHeaderExists(expected.name(), expected.value())

@varargs def assertRejections(expectedRejections: Rejection*): TestRouteResult = {
if (rejections.asScala == expectedRejections.toSeq) {
this
Expand Down

0 comments on commit 73d4f72

Please sign in to comment.