Fix BasicRequestsTest.testReadSelectPartial for nesting-preserving field projection#650
Merged
vharseko merged 1 commit intoJun 11, 2026
Conversation
…eld projection Resources.filterResource now preserves the nested structure of requested JsonPointers instead of collapsing them to their leaf names (see commons fix for OpenIDM discussion OpenIdentityPlatform#183). As a result, projecting "/name/surname" over a resource returns { "name": { "surname": "user 1" } } rather than the previously flattened { "surname": "user 1" }. testReadSelectPartial still asserted the old flattening behavior and started failing with "<{'surname'='user 1'}> should be null". Update the assertions to match the corrected, nesting-preserving projection: - expect get("name") to be a non-null map - read the value via the nested path name/surname ("user 1") - expect the top-level "surname" field to be null No production code changes; this aligns the test with the fixed Resources.filterResource semantics.
maximthomas
approved these changes
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After the
commonschange OpenIdentityPlatform/commons@3bb9a67 that makesResources.filterResourcepreserve thenested structure of requested fields (see OpenIDM discussion
#183), the
opendj-rest2ldaptestBasicRequestsTest.testReadSelectPartialstartedfailing. This PR updates the test assertions to match the corrected,
nesting-preserving projection behavior.
Background
Previously,
Resources.filterResource(JsonValue, Collection<JsonPointer>)collapsed a nested pointer (e.g.
name/surname) to its leaf name, producing aflat result like
{ "surname": "user 1" }. Thecommonsfix now writes eachrequested pointer back under its full path via
JsonValue.putPermissive(...),so the same read returns:
{ "name": { "surname": "user 1" } }Problem
testReadSelectPartialstill asserted the old flattening behavior and failedwith:
This is not a regression in production code — the test was encoding the very
behavior that the
commonsfix corrected.Changes
Updated the assertions in
testReadSelectPartial(
opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/BasicRequestsTest.java)to reflect the nesting-preserving projection:
get("name").asMap()is now expected to be non-null.name/surname("user 1").surnamefield is now expected to be null.No production code was changed.
Testing
mvn -pl opendj-rest2ldap test -Dtest=BasicRequestsTestAll 57 tests in
BasicRequestsTestpass.