Skip to content

Commit edd3c0c

Browse files
committed
Polishing.
Simplify stream collector, add author tag and ticket references. See #573
1 parent 73641fd commit edd3c0c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)