Class RequestResult
java.lang.Object
com.soklet.RequestResult
Encapsulates the results of a request that would normally be handled by your
Server (both logical response and bytes to be sent over the wire), used for integration testing via Simulator.performRequest(Request).
Instances can be acquired via the withMarshaledResponse(MarshaledResponse) factory method.
The Server-Sent Event equivalent of this type is ServerSentEventRequestResult, which is used for integration testing via Simulator.performServerSentEventRequest(Request).
See https://www.soklet.com/docs/testing#integration-testing for detailed documentation.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder used to construct instances ofRequestResultviawithMarshaledResponse(MarshaledResponse).static final classBuilder used to copy instances ofRequestResultviacopy(). -
Method Summary
Modifier and TypeMethodDescriptioncopy()Vends a mutable copier seeded with this instance's data, suitable for building new instances.booleanThe CORS preflight logical response, if applicable for the request.The final representation of the response to be written over the wire.The Resource Method that handled the request, if available.The logical response, determined by the return value of the Resource Method (if available).inthashCode()toString()static RequestResult.BuilderwithMarshaledResponse(MarshaledResponse marshaledResponse) Acquires a builder forRequestResultinstances.
-
Method Details
-
withMarshaledResponse
@Nonnull public static RequestResult.Builder withMarshaledResponse(@Nonnull MarshaledResponse marshaledResponse) Acquires a builder forRequestResultinstances.- Parameters:
marshaledResponse- the bytes that will ultimately be written over the wire- Returns:
- the builder
-
copy
Vends a mutable copier seeded with this instance's data, suitable for building new instances.- Returns:
- a copier for this instance
-
toString
-
equals
-
hashCode
-
getMarshaledResponse
The final representation of the response to be written over the wire.- Returns:
- the response to be written over the wire
-
getResponse
The logical response, determined by the return value of the Resource Method (if available).- Returns:
- the logical response
-
getCorsPreflightResponse
The CORS preflight logical response, if applicable for the request.- Returns:
- the CORS preflight logical response
-
getResourceMethod
The Resource Method that handled the request, if available.- Returns:
- the Resource Method that handled the request
-