Skip to content

Add test coverage for Map-based multi-field sort#15691

Open
jamesfredley wants to merge 2 commits into
7.0.xfrom
test/map-sort-coverage
Open

Add test coverage for Map-based multi-field sort#15691
jamesfredley wants to merge 2 commits into
7.0.xfrom
test/map-sort-coverage

Conversation

@jamesfredley
Copy link
Copy Markdown
Contributor

Summary

Adds test coverage for the Map-based multi-field sort argument on GORM queries, exercising DynamicFinder.applySortForMap() through both list() and dynamic finders.

This path lets callers pass a Map of property to direction, e.g. query.list(sort: [firstName: "asc", lastName: "desc"]), producing multiple ORDER BY clauses. It was documented in #15599 but had no test coverage, so this PR locks in the contract that was documented.

Changes

  • OrderBySpec: three new feature methods covering
    • multi-field Map sort, all ascending, via list()
    • multi-field Map sort with mixed directions via list()
    • multi-field Map sort via a dynamic finder

Testing

./gradlew :grails-datamapping-core-test:test --tests "org.grails.datastore.gorm.OrderBySpec"

All feature methods pass.

Follow-up to #15599 (review note about missing test coverage for the Map-sort path).

Adds OrderBySpec coverage for passing a Map to the sort argument, which
exercises DynamicFinder.applySortForMap() through both list() and dynamic
finders. This multi-field sort path (one direction per field) was
documented in #15599 but had no test coverage.

Assisted-by: claude-code:claude-4.8-opus
Copilot AI review requested due to automatic review settings May 29, 2026 02:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Spock coverage for the previously-documented Map-based multi-field sort argument on GORM queries, ensuring DynamicFinder.applySortForMap() behavior is exercised via both list() and dynamic finder execution paths.

Changes:

  • Adds a list() test for multi-field Map sort with all ascending directions.
  • Adds a list() test for multi-field Map sort with mixed (asc/desc) directions.
  • Adds a dynamic finder test that passes Map-based multi-field sort via finder arguments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@testlens-app
Copy link
Copy Markdown

testlens-app Bot commented May 29, 2026

✅ All tests passed ✅

🏷️ Commit: ede2cef
▶️ Tests: 122 executed
⚪️ Checks: 33/33 completed


Learn more about TestLens at testlens.app.

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants