mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
PathApiVersionResolver is not nullable
Closes gh-35265
This commit is contained in:
+6
@@ -22,6 +22,7 @@ import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
|
||||
import org.springframework.web.util.ServletRequestPathUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link PathApiVersionResolver}.
|
||||
@@ -35,6 +36,11 @@ public class PathApiVersionResolverTests {
|
||||
testResolve(1, "/app/1.1/path", "1.1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void insufficientPathSegments() {
|
||||
assertThatThrownBy(() -> testResolve(0, "/", "1.0")).isInstanceOf(InvalidApiVersionException.class);
|
||||
}
|
||||
|
||||
private static void testResolve(int index, String requestUri, String expected) {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", requestUri);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user