Refactoring in ApiVersionInserter

Refine naming of static factory methods, and update them to be
shortcuts for instance creation.

See gh-34919
This commit is contained in:
rstoyanchev
2025-05-19 07:25:21 +01:00
parent f4f0e52003
commit 5b19f6249e
6 changed files with 45 additions and 42 deletions

View File

@@ -41,19 +41,19 @@ public class ApiVersionTests {
@Test
void header() {
Map<String, String> result = performRequest(ApiVersionInserter.fromHeader("X-API-Version").build());
Map<String, String> result = performRequest(ApiVersionInserter.useHeader("X-API-Version"));
assertThat(result.get(HEADER_NAME)).isEqualTo("1.2");
}
@Test
void queryParam() {
Map<String, String> result = performRequest(ApiVersionInserter.fromQueryParam("api-version").build());
Map<String, String> result = performRequest(ApiVersionInserter.useQueryParam("api-version"));
assertThat(result.get("query")).isEqualTo("api-version=1.2");
}
@Test
void pathSegment() {
Map<String, String> result = performRequest(ApiVersionInserter.fromPathSegment(0).build());
Map<String, String> result = performRequest(ApiVersionInserter.usePathSegment(0));
assertThat(result.get("path")).isEqualTo("/1.2/path");
}