17
17
18
18
import static org .assertj .core .api .Assertions .*;
19
19
20
- import java .util .List ;
21
- import java .util .Optional ;
22
-
23
20
import javax .naming .InvalidNameException ;
24
21
import javax .naming .ldap .LdapName ;
25
22
@@ -47,7 +44,7 @@ public class PersonRepositoryIntegrationTests {
47
44
@ Test
48
45
void findOneByName () throws InvalidNameException {
49
46
50
- Optional < Person > person = personRepository .findById (new LdapName ("uid=bob,ou=people,dc=springframework,dc=org" ));
47
+ var person = personRepository .findById (new LdapName ("uid=bob,ou=people,dc=springframework,dc=org" ));
51
48
52
49
assertThat (person ).hasValueSatisfying (it -> {
53
50
assertThat (it .getFullName ()).isEqualTo ("Bob Hamilton" );
@@ -62,7 +59,7 @@ void findOneByName() throws InvalidNameException {
62
59
@ Test
63
60
void findAll () {
64
61
65
- Iterable < Person > people = personRepository .findAll ();
62
+ var people = personRepository .findAll ();
66
63
67
64
assertThat (people ).hasSize (3 ).extracting ("uid" ).contains ("bob" , "joe" , "ben" );
68
65
}
@@ -73,7 +70,7 @@ void findAll() {
73
70
@ Test
74
71
void findByLastname () {
75
72
76
- List < Person > people = personRepository .findByLastnameStartsWith ("Ham" );
73
+ var people = personRepository .findByLastnameStartsWith ("Ham" );
77
74
78
75
assertThat (people ).hasSize (1 ).extracting ("uid" ).contains ("bob" );
79
76
}
@@ -86,14 +83,14 @@ void findByLastname() {
86
83
@ Test
87
84
void addUser () throws InvalidNameException {
88
85
89
- Person walter = new Person ();
86
+ var walter = new Person ();
90
87
walter .setFullName ("Walter White" );
91
88
walter .setUid ("heisenberg" );
92
89
walter .setLastname ("White" );
93
90
94
91
personRepository .save (walter );
95
92
96
- List < Person > people = personRepository .findByUid ("heisenberg" );
93
+ var people = personRepository .findByUid ("heisenberg" );
97
94
98
95
assertThat (people ).hasSize (1 ).extracting ("fullName" ).contains ("Walter White" );
99
96
0 commit comments