You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our unit tests we mock some MongoTemplate.find(Query) methods where the queries have with(Pageable pageable) applied to them. After upgrading Spring Boot from 3.x.x to 3.2.0, our test no longer works.
After some digging it seems like the issue is inside the equals implementation of org.springframework.data.mongodb.core.query.Query#querySettingsEquals. The limit is compared by == but is no longer an int but a org.springframework.data.domain.Limit instead.
querySettingsEquals:
limit:
As a result, if I create two Queries each with the same limit, they can never be equal. In our case this prevents us from mocking, since Mockito will not be able to match the mocked method:
In our unit tests we mock some
MongoTemplate.find(Query)
methods where the queries havewith(Pageable pageable)
applied to them. After upgrading Spring Boot from 3.x.x to 3.2.0, our test no longer works.After some digging it seems like the issue is inside the equals implementation of
org.springframework.data.mongodb.core.query.Query#querySettingsEquals
. Thelimit
is compared by==
but is no longer anint
but aorg.springframework.data.domain.Limit
instead.querySettingsEquals:

limit:

As a result, if I create two Queries each with the same limit, they can never be equal. In our case this prevents us from mocking, since Mockito will not be able to match the mocked method:
The text was updated successfully, but these errors were encountered: