diff --git a/ldap/example/pom.xml b/ldap/example/pom.xml
index ffa9c664..23ab90ed 100644
--- a/ldap/example/pom.xml
+++ b/ldap/example/pom.xml
@@ -13,4 +13,17 @@
../pom.xml
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED
+
+
+
+
+
+
diff --git a/ldap/example/src/test/java/example/springdata/ldap/PersonRepositoryIntegrationTests.java b/ldap/example/src/test/java/example/springdata/ldap/PersonRepositoryIntegrationTests.java
index 3a08123b..2a957146 100644
--- a/ldap/example/src/test/java/example/springdata/ldap/PersonRepositoryIntegrationTests.java
+++ b/ldap/example/src/test/java/example/springdata/ldap/PersonRepositoryIntegrationTests.java
@@ -17,9 +17,6 @@ package example.springdata.ldap;
import static org.assertj.core.api.Assertions.*;
-import java.util.List;
-import java.util.Optional;
-
import javax.naming.InvalidNameException;
import javax.naming.ldap.LdapName;
@@ -47,7 +44,7 @@ public class PersonRepositoryIntegrationTests {
@Test
void findOneByName() throws InvalidNameException {
- Optional person = personRepository.findById(new LdapName("uid=bob,ou=people,dc=springframework,dc=org"));
+ var person = personRepository.findById(new LdapName("uid=bob,ou=people,dc=springframework,dc=org"));
assertThat(person).hasValueSatisfying(it -> {
assertThat(it.getFullName()).isEqualTo("Bob Hamilton");
@@ -62,7 +59,7 @@ public class PersonRepositoryIntegrationTests {
@Test
void findAll() {
- Iterable people = personRepository.findAll();
+ var people = personRepository.findAll();
assertThat(people).hasSize(3).extracting("uid").contains("bob", "joe", "ben");
}
@@ -73,7 +70,7 @@ public class PersonRepositoryIntegrationTests {
@Test
void findByLastname() {
- List people = personRepository.findByLastnameStartsWith("Ham");
+ var people = personRepository.findByLastnameStartsWith("Ham");
assertThat(people).hasSize(1).extracting("uid").contains("bob");
}
@@ -86,14 +83,14 @@ public class PersonRepositoryIntegrationTests {
@Test
void addUser() throws InvalidNameException {
- Person walter = new Person();
+ var walter = new Person();
walter.setFullName("Walter White");
walter.setUid("heisenberg");
walter.setLastname("White");
personRepository.save(walter);
- List people = personRepository.findByUid("heisenberg");
+ var people = personRepository.findByUid("heisenberg");
assertThat(people).hasSize(1).extracting("fullName").contains("Walter White");
diff --git a/map/src/test/java/example/springdata/map/PersonRepositoryIntegrationTest.java b/map/src/test/java/example/springdata/map/PersonRepositoryIntegrationTest.java
index 80c58fad..36434a1c 100644
--- a/map/src/test/java/example/springdata/map/PersonRepositoryIntegrationTest.java
+++ b/map/src/test/java/example/springdata/map/PersonRepositoryIntegrationTest.java
@@ -17,9 +17,8 @@ package example.springdata.map;
import static org.assertj.core.api.Assertions.*;
-import java.util.List;
-
import org.junit.jupiter.api.Test;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
@@ -43,7 +42,7 @@ class PersonRepositoryIntegrationTest {
@Test
void storesPerson() {
- Person person = repository.save(new Person("Dave", "Matthews", 47));
+ var person = repository.save(new Person("Dave", "Matthews", 47));
assertThat(repository.findById(person.getId())).hasValue(person);
}
@@ -51,12 +50,11 @@ class PersonRepositoryIntegrationTest {
@Test
void findsPersonByAge() {
- Person dave = repository.save(new Person("Dave", "Matthews", 47));
- Person oliver = repository.save(new Person("Oliver August", "Matthews", 7));
+ var dave = repository.save(new Person("Dave", "Matthews", 47));
+ var oliver = repository.save(new Person("Oliver August", "Matthews", 7));
- List result = repository.findByAgeGreaterThan(18);
+ var result = repository.findByAgeGreaterThan(18);
- assertThat(result).contains(dave);
- assertThat(result).doesNotContain(oliver);
+ assertThat(result).contains(dave).doesNotContain(oliver);
}
}