java.lang.Object
com.renomad.minum.web.FunctionalTesting
Tools to enable system-wide integration testing
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
AResponse
designed to work withFunctionalTesting
-
Constructor Summary
ConstructorDescriptionFunctionalTesting
(Context context, String host, int port) Allows the user to set the host and port to target for testing. -
Method Summary
Modifier and TypeMethodDescriptionSend a GET request (as a client to the server)Send a GET request (as a client to the server)innerClientSend
(ISocketWrapper client, RequestLine.Method method, String path, byte[] payload, List<String> extraHeaders) Send a POST request (as a client to the server) using url encodingSend a POST request (as a client to the server) using url encodingsend
(RequestLine.Method method, String path) Send a request as a client to the serversend
(RequestLine.Method method, String path, byte[] payload, List<String> extraHeaders) Send a request as a client to the server
-
Constructor Details
-
FunctionalTesting
Allows the user to set the host and port to target for testing.
-
-
Method Details
-
get
Send a GET request (as a client to the server)- Parameters:
path
- the path to an endpoint, that is, the value for path that is entered inWebFramework.registerPath(RequestLine.Method, String, ThrowingFunction)
for pathname
-
get
Send a GET request (as a client to the server)- Parameters:
path
- the path to an endpoint, that is, the value for path that is entered inWebFramework.registerPath(RequestLine.Method, String, ThrowingFunction)
for pathnameextraHeaders
- a list containing extra headers you need the client to send, for example,List.of("cookie: id=foo")
-
post
Send a POST request (as a client to the server) using url encoding- Parameters:
path
- the path to an endpoint, that is, the value for path that is entered inWebFramework.registerPath(RequestLine.Method, String, ThrowingFunction)
for pathnamepayload
- a body payload in string form
-
post
Send a POST request (as a client to the server) using url encoding- Parameters:
path
- the path to an endpoint, that is, the value for path that is entered inWebFramework.registerPath(RequestLine.Method, String, ThrowingFunction)
for pathnamepayload
- a body payload in string formextraHeaders
- a list containing extra headers you need the client to send, for example,List.of("cookie: id=foo")
-
send
Send a request as a client to the serverThis helper method is the same as
send(RequestLine.Method, String, byte[], List)
except it will set the body as empty and does not require any extra headers to be set. In this case, the headers sent are very minimal. See the source.- Parameters:
path
- the path to an endpoint, that is, the value for path that is entered inWebFramework.registerPath(RequestLine.Method, String, ThrowingFunction)
for pathname
-
send
public FunctionalTesting.TestResponse send(RequestLine.Method method, String path, byte[] payload, List<String> extraHeaders) Send a request as a client to the server- Parameters:
path
- the path to an endpoint, that is, the value for path that is entered inWebFramework.registerPath(RequestLine.Method, String, ThrowingFunction)
for pathnamepayload
- a body payload in byte array formextraHeaders
- a list containing extra headers you need the client to send, for example,List.of("cookie: id=foo")
- Returns:
- a properly-built client, or null if exceptions occur
-
innerClientSend
public FunctionalTesting.TestResponse innerClientSend(ISocketWrapper client, RequestLine.Method method, String path, byte[] payload, List<String> extraHeaders) throws IOException - Throws:
IOException
-