Skip to content

Instantly share code, notes, and snippets.

@tomatophobia
Created July 2, 2023 18:39
@RegisterExtension
static ServerExtension server = ...;
@Test
void testRestApi() {
WebTestClient client = server.webTestClient();
client.get("/api/v1/carts")
.execute()
.assertStatus().isEqualTo(HttpStatus.OK) // or `isOk()` as an alias
.assertHeaders().contain(HttpHeaderNames.CONTENT_TYPE, MediaType.JSON)
.assertBody().contain(...)
.assertTrailers().isEqualTo(Map.of(...));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment