From 2ae21ca20429b6ee782d129d48394cafb7db33de Mon Sep 17 00:00:00 2001 From: Valera V Harseko Date: Thu, 11 Jun 2026 12:57:07 +0300 Subject: [PATCH] Fix BasicRequestsTest.testReadSelectPartial for nesting-preserving field 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 #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. --- .../forgerock/opendj/rest2ldap/BasicRequestsTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/BasicRequestsTest.java b/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/BasicRequestsTest.java index cb1bab0c8d..fa93ea44a9 100644 --- a/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/BasicRequestsTest.java +++ b/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/BasicRequestsTest.java @@ -13,6 +13,7 @@ * * Copyright 2013-2016 ForgeRock AS. * Portions Copyright 2017 Rosie Applications, Inc. + * Portions Copyright 2026 3A Systems, LLC */ package org.forgerock.opendj.rest2ldap; @@ -805,8 +806,12 @@ public void testReadSelectPartial() throws Exception { assertThat(resource.getId()).isEqualTo("test1"); assertThat(resource.getRevision()).isEqualTo("12345"); assertThat(resource.getContent().get("_id").asString()).isNull(); - assertThat(resource.getContent().get("name").asMap()).isNull(); - assertThat(resource.getContent().get("surname").asString()).isEqualTo("user 1"); + // The nested structure of the requested field is now preserved: the + // projected "/name/surname" is returned as { "name": { "surname": ... } } + // instead of being collapsed to a top-level "surname" field. + assertThat(resource.getContent().get("name").asMap()).isNotNull(); + assertThat(resource.getContent().get("name").get("surname").asString()).isEqualTo("user 1"); + assertThat(resource.getContent().get("surname").asString()).isNull(); assertThat(resource.getContent().get("_rev").asString()).isNull(); }