- Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Closed
Copy link
Labels
type: documentationA documentation updateA documentation update
Milestone
Description
This follows the issue Improve documentation for uri(URI) method in WebTestClient regarding base URI where all details are explained.
To summarize:
- Using WebTestClient without
@AutoConfigureWebTestClient
and with@SpringBootTest(webEnvironment = RANDOM_PORT)
, make the integration tests not working without the base URI (Error: Connection refused). - Using WebTestClient with
@AutoConfigureWebTestClient
and@SpringBootTest(webEnvironment = RANDOM_PORT)
, make the tests work without the base URI.
I think this is not expected and it's not coherent from a developer prospective or at least need to be documented. See the link above for more details.
What I expect is that this code:
@SpringBootTest(webEnvironment = RANDOM_PORT) @ActiveProfiles("test") @Sql("classpath:sql/my_sql.sql") @Import(TestConfig.class)
URI uri = UriComponentsBuilder .fromUriString(MY_URL) .queryParam("year", 2005) .buildAndExpand() .toUri(); client.get() .uri(uri) .exchange() .expectStatus() .is2xxSuccessful();
has the same behaviour with the @AutoConfigureWebTestClient
since @SpringBootTest
by default configures a WebTestClient
Metadata
Metadata
Assignees
Labels
type: documentationA documentation updateA documentation update