Skip to content

Improve testing for building SortFields in SortBuilders #17286

@cbuescher

Description

@cbuescher

This is a follow up issue as discussed in #17205. We have added randomized roundtrip testing for SortBuilders (toXContent -> fromXContent) and serialization tests in AbstractSortBuilderTests, but currently we do no very thourough testing of the SortField that is emitted when calling the sort builders build() method. Most of this is covered by other integration tests, but we should investigate if we can improve the assertions made on the SortFields, while keeping the tests simple.
One of the challanges here is that most sort builders create SortFields of SortField.Type.CUSTOM, providing their own FieldComparatorSource, which in turn wraps most of the builders options and is difficult to access from tests.

Metadata

Metadata

Assignees

Labels

:Search/SearchSearch-related issues that do not fall into other categories>enhancement>testIssues or PRs that are addressing/adding testshelp wantedadoptme

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions