Fix ldap-odm unit tests
This commit is contained in:
@@ -4,11 +4,13 @@ import java.util.List;
|
||||
|
||||
import javax.naming.ldap.LdapName;
|
||||
|
||||
import org.springframework.aot.hint.annotation.RegisterReflectionForBinding;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.LdapNameBuilder;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RegisterReflectionForBinding(Person.class)
|
||||
public class OdmPersonDaoImpl implements PersonDao {
|
||||
|
||||
private final LdapTemplate ldapTemplate;
|
||||
|
||||
@@ -9,22 +9,23 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.data.ldap.DataLdapTest;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@DataLdapTest
|
||||
@Import(OdmPersonDaoImpl.class)
|
||||
class DataLdapTests {
|
||||
|
||||
@Autowired
|
||||
private LdapTemplate ldapTemplate;
|
||||
private PersonDao personDao;
|
||||
|
||||
@Test
|
||||
void saveAndLoad() throws InvalidNameException {
|
||||
Person person = getPerson();
|
||||
this.ldapTemplate.create(person);
|
||||
this.personDao.create(person);
|
||||
|
||||
List<Person> persons = this.ldapTemplate.findAll(Person.class);
|
||||
List<Person> persons = this.personDao.findAll();
|
||||
assertThat(persons).contains(person);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user