Description
Sam Brannen opened SPR-11385 and commented
Status Quo
AnnotationDrivenStaticEntityMockingControlTests
has been omitted from the build for quite some time (perhaps forever) since it was previously named AnnotationDrivenStaticEntityMockingControlTest
which did not comply with Spring Framework's naming convention for test classes. Consequently, the tests within this class have not been included in the test suite.
Due to changes to the build configuration in #16011, it is now apparent that some of the tests in AnnotationDrivenStaticEntityMockingControlTests
are broken.
Analysis
Initial analysis of the failing tests has made it apparent that there is an off-by-one bug in the implementation of AbstractMethodMockingControl.Expectations.nextCall()
. Specifically, the verified
count is one-based; whereas, the calls
list is zero-based. Therefore, returning calls.get(verified)
leads to inappropriate behavior (i.e., either accessing the wrong call or out-of-bounds exceptions).
Further analysis reveals that this off-by-one bug is in fact a regression that was accidentally introduced in the fix for #15513.
Deliverables
- Fix the off-by-one bug in
AbstractMethodMockingControl.Expectations.nextCall()
. - Ensure that all broken tests (currently annotated with
@Ignore
) inAnnotationDrivenStaticEntityMockingControlTests
pass once again.
Affects: 3.2.5
Issue Links:
- Abstract method mocking prints wrong call count in exception [SPR-10885] #15513 Abstract method mocking prints wrong call count in exception
- Ensure all tests are executed in the Gradle build [SPR-11384] #16011 Ensure all tests are executed in the Gradle build
Referenced from: commits 3a89bc4, 03e243a, 69a89b1
Backported to: 3.2.8