Relax relative path existence assertion for parsed URIs
See gh-29481 See gh-28522
This commit is contained in:
parent
6a2262969e
commit
c1014f5989
|
|
@ -30,7 +30,6 @@ import org.springframework.core.io.Resource;
|
|||
import org.springframework.core.io.UrlResource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link PathResourceResolver}.
|
||||
|
|
@ -101,9 +100,6 @@ public class PathResourceResolverTests {
|
|||
private void testCheckResource(Resource location, String requestPath) throws IOException {
|
||||
List<Resource> locations = Collections.singletonList(location);
|
||||
Resource actual = this.resolver.resolveResource(null, requestPath, locations, null).block(TIMEOUT);
|
||||
if (!location.createRelative(requestPath).exists() && !requestPath.contains(":")) {
|
||||
fail(requestPath + " doesn't actually exist as a relative path");
|
||||
}
|
||||
assertThat(actual).isNull();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
|
@ -412,9 +411,6 @@ class ResourceWebHandlerTests {
|
|||
assertThat(((ResponseStatusException) err).getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
|
||||
})
|
||||
.verify(TIMEOUT);
|
||||
if (!location.createRelative(requestPath).exists() && !requestPath.contains(":")) {
|
||||
fail(requestPath + " doesn't actually exist as a relative path");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import org.springframework.web.testfixture.servlet.MockServletContext;
|
|||
import org.springframework.web.util.UrlPathHelper;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link PathResourceResolver}.
|
||||
|
|
@ -86,9 +85,6 @@ public class PathResourceResolverTests {
|
|||
private void testCheckResource(Resource location, String requestPath) throws IOException {
|
||||
List<Resource> locations = Collections.singletonList(location);
|
||||
Resource actual = this.resolver.resolveResource(null, requestPath, locations, null);
|
||||
if (!location.createRelative(requestPath).exists() && !requestPath.contains(":")) {
|
||||
fail(requestPath + " doesn't actually exist as a relative path");
|
||||
}
|
||||
assertThat(actual).isNull();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ import org.springframework.web.testfixture.servlet.MockServletContext;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
|
@ -414,9 +413,6 @@ class ResourceHttpRequestHandlerTests {
|
|||
this.request.setAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, requestPath);
|
||||
this.response = new MockHttpServletResponse();
|
||||
this.handler.handleRequest(this.request, this.response);
|
||||
if (!location.createRelative(requestPath).exists() && !requestPath.contains(":")) {
|
||||
fail(requestPath + " doesn't actually exist as a relative path");
|
||||
}
|
||||
assertThat(this.response.getStatus()).isEqualTo(HttpStatus.NOT_FOUND.value());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue