File tree Expand file tree Collapse file tree
main/java/org/baeldung/model
test/java/org/baeldung/mongotemplate Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,26 +9,19 @@ public class EmailAddress {
99 private String id ;
1010 private String value ;
1111
12- public EmailAddress () {
13- }
14-
15- public EmailAddress (String value ) {
16- this .value = value ;
17- }
18-
1912 public String getId () {
2013 return id ;
2114 }
2215
23- public void setId (String id ) {
16+ public void setId (final String id ) {
2417 this .id = id ;
2518 }
2619
2720 public String getValue () {
2821 return value ;
2922 }
3023
31- public void setValue (String value ) {
24+ public void setValue (final String value ) {
3225 this .value = value ;
3326 }
3427}
Original file line number Diff line number Diff line change @@ -26,15 +26,6 @@ public class User {
2626 @ CascadeSave
2727 private EmailAddress emailAddress ;
2828
29- public User () {
30- }
31-
32- public User (String name , Integer age , String value ) {
33- this .name = name ;
34- this .age = age ;
35- this .emailAddress = new EmailAddress (value );
36- }
37-
3829 public String getId () {
3930 return id ;
4031 }
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ public void givenUsersExist_whenFindingUsersAndSortThem_thenUsersAreFoundAndSort
137137
138138 @ Test
139139 public void givenUserExistsWithIndexAddedFromMapping_whenCheckingIndex_thenIndexIsExisted () {
140- User user = new User ();
140+ final User user = new User ();
141141 user .setName ("Brendan" );
142142 EmailAddress emailAddress = new EmailAddress ();
143143 emailAddress .setValue ("a@gmail.com" );
@@ -151,7 +151,7 @@ public void givenUserExistsWithIndexAddedFromMapping_whenCheckingIndex_thenIndex
151151
152152 @ Test
153153 public void whenSavingUserWithEmailAddress_thenUserandEmailAddressSaved () {
154- User user = new User ();
154+ final User user = new User ();
155155 user .setName ("Brendan" );
156156 EmailAddress emailAddress = new EmailAddress ();
157157 emailAddress .setValue ("b@gmail.com" );
@@ -163,7 +163,7 @@ public void whenSavingUserWithEmailAddress_thenUserandEmailAddressSaved() {
163163
164164 @ Test
165165 public void givenUserExistsWithIndexAddedFromCode_whenCheckingIndex_thenIndexIsExisted () {
166- User user = new User ();
166+ final User user = new User ();
167167 user .setName ("Brendan" );
168168 mongoTemplate .indexOps (User .class ).ensureIndex (new Index ().on ("name" , Direction .ASC ));
169169 mongoTemplate .insert (user );
You can’t perform that action at this time.
0 commit comments