"Wiremock" for RSocket
If you have an application that connects to an RSocket server at runtime, how do you test it? We need a way for a test to start a server and tell us where it is listening, and then we need to be able to register request and response examples (a.k.a. "contracts"). That’s what this project provides - it’s like Wiremock but for RSocket.
Getting Started
The easiest way to use the project is as a JUnit (Jupiter) extension, e.g:
@SpringBootTest
@ExtendWith(RSocketServerExtension.class)
class SocketsApplicationTests {
...
}
With this extension installed the Spring Boot tests will run with an RSocket server listening on a port given by test.rsocket.server.port
, so the test can connect directly to it, or (more likely) the code that it is testing will connect to it. You might need to tell it where to connect via the @SpringBootTest
annotation, e.g. if the application is looking for a property at runtime called rsocket.port
…