Restore setExtractBareNamePropertyMethods() for AssertJ

Closes gh-16325
pull/16341/head
Johnny Lim 6 years ago committed by Stephane Nicoll
parent a2d37dc0b9
commit 038e213343

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

Loading…
Cancel
Save