Skip to content

Commit 213d8c4

Browse files
committed
Polishing.
Simplify stream collector, add author tag and ticket references. See #573
1 parent f0724eb commit 213d8c4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/main/java/org/springframework/data/ldap/repository/query/LdapQueryCreator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class LdapQueryCreator extends AbstractQueryCreator<LdapQuery, ContainerCriteria
5353
* @param tree must not be {@literal null}.
5454
* @param entityType must not be {@literal null}.
5555
* @param mapper must not be {@literal null}.
56-
* @param values must not be {@literal null}.
56+
* @param parameterAccessor must not be {@literal null}.
5757
* @param inputProperties must not be {@literal null}.
5858
*/
5959
LdapQueryCreator(PartTree tree, Class<?> entityType, ObjectDirectoryMapper mapper,
@@ -81,7 +81,8 @@ protected ContainerCriteria create(Part part, Iterator<Object> iterator) {
8181
}
8282

8383
if (!inputProperties.isEmpty()) {
84-
query.attributes(inputProperties.stream().map(prop -> mapper.attributeFor(entityType, prop)).toList().toArray(new String[0]));
84+
query.attributes(
85+
inputProperties.stream().map(prop -> mapper.attributeFor(entityType, prop)).toArray(String[]::new));
8586
}
8687

8788
ConditionCriteria criteria = query.where(getAttribute(part));

src/test/java/org/springframework/data/ldap/repository/LdapRepositoryUnitTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
* Unit tests for {@link LdapRepository}.
4242
*
4343
* @author Mark Paluch
44+
* @author Xiangcheng Kuo
4445
*/
4546
@MockitoSettings
4647
class LdapRepositoryUnitTests {
@@ -63,7 +64,7 @@ void before() throws Exception {
6364
repository = new LdapRepositoryFactory(ldapOperations).getRepository(PersonRepository.class);
6465
}
6566

66-
@Test
67+
@Test // GH-573
6768
void shouldReturnInterfaceProjection() {
6869

6970
when(ldapOperations.findOne(any(LdapQuery.class), eq(UnitTestPerson.class))).thenReturn(walter);
@@ -81,7 +82,7 @@ void shouldReturnInterfaceProjection() {
8182
assertThat(query.attributes()).containsOnly("sn");
8283
}
8384

84-
@Test
85+
@Test // GH-573
8586
void shouldReturnDynamicDtoProjection() {
8687

8788
when(ldapOperations.findOne(any(LdapQuery.class), eq(UnitTestPerson.class))).thenReturn(walter);
@@ -99,7 +100,7 @@ void shouldReturnDynamicDtoProjection() {
99100
assertThat(query.attributes()).contains("sn");
100101
}
101102

102-
@Test
103+
@Test // GH-573
103104
void shouldReturnInterfaceProjectionAsStream() {
104105

105106
when(ldapOperations.find(any(LdapQuery.class), eq(UnitTestPerson.class)))

0 commit comments

Comments
 (0)