-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
After upgrading to Spring 6.2.0 (spring boot 3.4.0) my tests with io.rest-assured mock mvc started to be flaky.
I discovered that the issue might be connected to ReflectionUtils.
In RestAssuredMockMvc there is call to
https://github.com/spring-projects/spring-framework/blob/main/spring-test/src/main/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilder.java through ReflectionUtils.
When
public static Method findMethod(Class<?> clazz, String name, @Nullable Class<?>... paramTypes)is called, then method returns.
Sometimes, method.isVarArgs returns true, sometimes false (when method.isBridge() is true).
Here's some test example to show the behavior:
@Test
void testMethod() {
var method = ReflectionUtils.findMethod(MockHttpServletRequestBuilder.class, "cookie", Cookie[].class);
System.out.println("IsBridge: " + method.isBridge());
System.out.println("IsVarArgs: " + method.isVarArgs());
assertTrue(method.isVarArgs());
}If you run the test multiple times, it will fail, but not always. In previous spring version method.isVarArgs always returned true. (At least I think so, it would explain why tests never failed before)