Browse Source

Revise tests to better express intent

pull/34656/head
Sam Brannen 10 months ago
parent
commit
8334cb1abb
  1. 6
      spring-webflux/src/test/java/org/springframework/web/reactive/function/server/PathResourceLookupFunctionTests.java
  2. 5
      spring-webmvc/src/test/java/org/springframework/web/servlet/function/PathResourceLookupFunctionTests.java

6
spring-webflux/src/test/java/org/springframework/web/reactive/function/server/PathResourceLookupFunctionTests.java

@ -31,6 +31,8 @@ import org.springframework.core.io.Resource;
import org.springframework.web.testfixture.http.server.reactive.MockServerHttpRequest; import org.springframework.web.testfixture.http.server.reactive.MockServerHttpRequest;
import org.springframework.web.testfixture.server.MockServerWebExchange; import org.springframework.web.testfixture.server.MockServerWebExchange;
import static org.assertj.core.api.Assertions.assertThatNoException;
/** /**
* @author Arjen Poutsma * @author Arjen Poutsma
*/ */
@ -128,13 +130,13 @@ class PathResourceLookupFunctionTests {
@SuppressWarnings("removal") @SuppressWarnings("removal")
void withPathResource() { void withPathResource() {
org.springframework.core.io.PathResource location = new org.springframework.core.io.PathResource("/static/"); org.springframework.core.io.PathResource location = new org.springframework.core.io.PathResource("/static/");
PathResourceLookupFunction function = new PathResourceLookupFunction("/resources/**", location); assertThatNoException().isThrownBy(() -> new PathResourceLookupFunction("/resources/**", location));
} }
@Test @Test
void withFileSystemResource() { void withFileSystemResource() {
FileSystemResource location = new FileSystemResource("/static/"); FileSystemResource location = new FileSystemResource("/static/");
PathResourceLookupFunction function = new PathResourceLookupFunction("/resources/**", location); assertThatNoException().isThrownBy(() -> new PathResourceLookupFunction("/resources/**", location));
} }
} }

5
spring-webmvc/src/test/java/org/springframework/web/servlet/function/PathResourceLookupFunctionTests.java

@ -29,6 +29,7 @@ import org.springframework.core.io.Resource;
import org.springframework.web.servlet.handler.PathPatternsTestUtils; import org.springframework.web.servlet.handler.PathPatternsTestUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatNoException;
/** /**
* @author Arjen Poutsma * @author Arjen Poutsma
@ -107,13 +108,13 @@ class PathResourceLookupFunctionTests {
@SuppressWarnings("removal") @SuppressWarnings("removal")
void withPathResource() { void withPathResource() {
org.springframework.core.io.PathResource location = new org.springframework.core.io.PathResource("/static/"); org.springframework.core.io.PathResource location = new org.springframework.core.io.PathResource("/static/");
PathResourceLookupFunction function = new PathResourceLookupFunction("/resources/**", location); assertThatNoException().isThrownBy(() -> new PathResourceLookupFunction("/resources/**", location));
} }
@Test @Test
void withFileSystemResource() { void withFileSystemResource() {
FileSystemResource location = new FileSystemResource("/static/"); FileSystemResource location = new FileSystemResource("/static/");
PathResourceLookupFunction function = new PathResourceLookupFunction("/resources/**", location); assertThatNoException().isThrownBy(() -> new PathResourceLookupFunction("/resources/**", location));
} }
} }

Loading…
Cancel
Save