Disable AssertJ's bare-named property accessor discovery

AssertJ includes a change in 3.12 that means that, by default, it now incorrectly
identifies some of the builder methods on CacheControl as accessor methods for its fields.
This commit restores the behaviour of 3.11 so that a method is only considered to be a
property accessor if a matches the Java bean naming conventions.

Closes gh-16145
pull/16174/head
Andy Wilkinson 6 years ago
parent e667911f91
commit 36cbd00853

@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit;
import javax.validation.ValidatorFactory; import javax.validation.ValidatorFactory;
import org.assertj.core.api.Assertions;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Test; import org.junit.Test;
@ -418,6 +419,7 @@ 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));
@ -436,6 +438,7 @@ 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)

Loading…
Cancel
Save