Browse Source

Restore setExtractBareNamePropertyMethods() for AssertJ

Closes gh-16325
pull/16341/head
Johnny Lim 7 years ago committed by Stephane Nicoll
parent
commit
038e213343
  1. 6
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java

6
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java

@ -413,23 +413,25 @@ public class WebFluxAutoConfigurationTests { @@ -413,23 +413,25 @@ public class WebFluxAutoConfigurationTests {
@Test
public void cachePeriod() {
Assertions.setExtractBareNamePropertyMethods(false);
this.contextRunner.withPropertyValues("spring.resources.cache.period:5")
.run((context) -> {
Map<PathPattern, Object> handlerMap = getHandlerMap(context);
assertThat(handlerMap).hasSize(2);
for (Object handler : handlerMap.values()) {
if (handler instanceof ResourceWebHandler) {
Assertions.setExtractBareNamePropertyMethods(false);
assertThat(((ResourceWebHandler) handler).getCacheControl())
.isEqualToComparingFieldByField(
CacheControl.maxAge(5, TimeUnit.SECONDS));
}
}
});
Assertions.setExtractBareNamePropertyMethods(true);
}
@Test
public void cacheControl() {
Assertions.setExtractBareNamePropertyMethods(false);
this.contextRunner
.withPropertyValues("spring.resources.cache.cachecontrol.max-age:5",
"spring.resources.cache.cachecontrol.proxy-revalidate:true")
@ -438,7 +440,6 @@ public class WebFluxAutoConfigurationTests { @@ -438,7 +440,6 @@ public class WebFluxAutoConfigurationTests {
assertThat(handlerMap).hasSize(2);
for (Object handler : handlerMap.values()) {
if (handler instanceof ResourceWebHandler) {
Assertions.setExtractBareNamePropertyMethods(false);
assertThat(((ResourceWebHandler) handler).getCacheControl())
.isEqualToComparingFieldByField(
CacheControl.maxAge(5, TimeUnit.SECONDS)
@ -446,6 +447,7 @@ public class WebFluxAutoConfigurationTests { @@ -446,6 +447,7 @@ public class WebFluxAutoConfigurationTests {
}
}
});
Assertions.setExtractBareNamePropertyMethods(true);
}
private Map<PathPattern, Object> getHandlerMap(ApplicationContext context) {

Loading…
Cancel
Save