api

http4k / org.http4k.testing

Package org.http4k.testing

Useful tools for testing http4k applications.

Types

Name Summary
ApprovalContent Determines which parts of the HttpMessage will be compared.interface ApprovalContent
ApprovalSource The backing store where the approved and actual content will be stored.interface ApprovalSource
ApprovalTest Standard Approval JUnit5 extension. Can be used to compare any HttpMessages.class ApprovalTest : BaseApprovalTest
Approver Coordinates the comparison of the content for a test.interface Approver
BaseApprovalTest Base JUnit extension for injecting an Approver into a JUnit5 test-case. Implement this to provide custom approval behaviours, orinterface BaseApprovalTest : BeforeTestExecutionCallback, ParameterResolver
ContentTypeAwareApprovalTest Approval testing JUnit5 extension that checks the expected content type is present in theabstract class ContentTypeAwareApprovalTest : BaseApprovalTest
FileSystemApprovalSource class FileSystemApprovalSource : ApprovalSource
HtmlApprovalTest Approval JUnit5 extension configured to compare prettified-HTML messages. Note that this stripsclass HtmlApprovalTest : ContentTypeAwareApprovalTest
JsonApprovalTest Approval JUnit5 extension configured to compare prettified-JSON messages.class JsonApprovalTest : ContentTypeAwareApprovalTest
NamedResourceApprover class NamedResourceApprover : Approver
ReadResource interface ReadResource
ReadWriteResource interface ReadWriteResource : ReadResource
RecordingEvents Simple recording events that can be used in testsclass RecordingEvents : Events, Iterable<Event>
TestNamer interface TestNamer
TestWsClient A class that is used for offline testing of a routed Websocket, without starting up a Server. Calls are routed synchronously to the receiving Websocket, and error are propagated to the caller.class TestWsClient : WsClient
XmlApprovalTest Approval JUnit5 extension configured to compare prettified-XML messages.class XmlApprovalTest : ContentTypeAwareApprovalTest

Exceptions

Name Summary
ApprovalFailed class ApprovalFailed : RuntimeException
ClosedWebsocket data class ClosedWebsocket : RuntimeException

Extensions for External Classes

Name Summary
kotlin.Function1  

Functions

Name Summary
<no name provided> Provides the identification of test case.fun <no name provided>(): Unit
assertApproved fun Approver.assertApproved(response: Response, expectedStatus: Status): Unit
fun Approver.assertApproved(content: String): Unit
fun Approver.assertApproved(content: InputStream): Unit
hasApprovedContent Create a Hamkrest Matcher for this message that can be combined with other Matchersfun <T : HttpMessage> Approver.hasApprovedContent(): Matcher<T>
testWsClient fun PolyHandler.testWsClient(request: Request): TestWsClient?