Skip to content

Fix unless coverage in class-level cacheable tests - #37334

Open
noojung wants to merge 1 commit into
spring-projects:mainfrom
noojung:cache-unless-tests
Open

noojung wants to merge 1 commit into
spring-projects:mainfrom
noojung:cache-unless-tests

Conversation

@noojung

@noojung noojung commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

classCacheUnlessExpression() used cs instead of ccs, duplicating unlessExpression().
This PR switches it to the class-level cacheable service in both spring-context and spring-aspects.

Exercising the intended service exposes two fixture inconsistencies:

  • AnnotatedClassCacheableService.unless() returned an Integer, while the shared assertion expects 10L. Return a Long, matching DefaultCacheableService.unless().
  • In cache-advice.xml, cacheAdviceClass declared the unless method without an unless condition, so it cached both 10 and 11. Add unless="#result > 10", matching cacheAdviceInterface, so only 10 is cached.

No production code is changed.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants