Skip to content

Commit 9912e48

Browse files
quaffchristophstrobl
authored andcommitted
Remove unnecessary javadoc from test code if method signature is self-described
Closes: #3332
1 parent 9a0a994 commit 9912e48

22 files changed

+7
-303
lines changed

spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/AuditableUser.java

-14
Original file line numberDiff line numberDiff line change
@@ -57,33 +57,19 @@ public AuditableUser(@Nullable Integer id, String firstname) {
5757
this.firstname = firstname;
5858
}
5959

60-
/**
61-
* Returns the firstname.
62-
*
63-
* @return the firstname
64-
*/
6560
public String getFirstname() {
66-
6761
return firstname;
6862
}
6963

70-
/**
71-
* Sets the firstname.
72-
*
73-
* @param firstname the firstname to set
74-
*/
7564
public void setFirstname(final String firstname) {
76-
7765
this.firstname = firstname;
7866
}
7967

8068
public void addRole(AuditableRole role) {
81-
8269
this.roles.add(role);
8370
}
8471

8572
public Set<AuditableRole> getRoles() {
86-
8773
return roles;
8874
}
8975
}

spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/Child.java

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ public class Child {
3333
@ManyToMany(mappedBy = "children")
3434
Set<Parent> parents = new HashSet<>();
3535

36-
/**
37-
* @param parent
38-
*/
3936
public Child add(Parent parent) {
4037

4138
this.parents.add(parent);

spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/Role.java

-24
Original file line numberDiff line numberDiff line change
@@ -33,50 +33,26 @@ public class Role {
3333
@Id @GeneratedValue private Integer id;
3434
private String name;
3535

36-
/**
37-
* Creates a new instance of {@code Role}.
38-
*/
3936
public Role() {}
4037

41-
/**
42-
* Creates a new preconfigured {@code Role}.
43-
*
44-
* @param name
45-
*/
4638
public Role(final String name) {
4739
this.name = name;
4840
}
4941

50-
/**
51-
* Returns the id.
52-
*
53-
* @return
54-
*/
5542
public Integer getId() {
56-
5743
return id;
5844
}
5945

60-
/**
61-
* @return the name
62-
*/
6346
public String getName() {
6447
return name;
6548
}
6649

6750
@Override
6851
public String toString() {
69-
7052
return PREFIX + name;
7153
}
7254

73-
/**
74-
* Returns whether the role is to be considered new.
75-
*
76-
* @return
77-
*/
7855
public boolean isNew() {
79-
8056
return id == null;
8157
}
8258
}

spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/SampleWithPrimitiveId.java

-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ public class SampleWithPrimitiveId {
2626

2727
@Id private long id;
2828

29-
/**
30-
* @param id the id to set
31-
*/
3229
public void setId(long id) {
3330
this.id = id;
3431
}

spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/User.java

+4-125
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,10 @@ public class User {
115115

116116
@Temporal(TemporalType.DATE) private Date dateOfBirth;
117117

118-
/**
119-
* Creates a new empty instance of {@code User}.
120-
*/
121118
public User() {
122119
this(null, null, null);
123120
}
124121

125-
/**
126-
* Creates a new instance of {@code User} with preinitialized values for firstname, lastname, email address and roles.
127-
*
128-
* @param firstname
129-
* @param lastname
130-
* @param emailAddress
131-
* @param roles
132-
*/
133122
public User(String firstname, String lastname, String emailAddress, Role... roles) {
134123

135124
this.firstname = firstname;
@@ -142,222 +131,119 @@ public User(String firstname, String lastname, String emailAddress, Role... role
142131
this.createdAt = new Date();
143132
}
144133

145-
/**
146-
* @return the id
147-
*/
148134
public Integer getId() {
149-
150135
return id;
151136
}
152137

153-
/**
154-
* @param id the id to set
155-
*/
156138
public void setId(Integer id) {
157-
158139
this.id = id;
159140
}
160141

161-
/**
162-
* Returns the firstname.
163-
*
164-
* @return the firstname
165-
*/
166142
public String getFirstname() {
167-
168143
return firstname;
169144
}
170145

171-
/**
172-
* Sets the firstname.
173-
*
174-
* @param firstname the firstname to set
175-
*/
176146
public void setFirstname(final String firstname) {
177-
178147
this.firstname = firstname;
179148
}
180149

181-
/**
182-
* Returns the lastname.
183-
*
184-
* @return the lastname
185-
*/
186150
public String getLastname() {
187-
188151
return lastname;
189152
}
190153

191-
/**
192-
* Sets the lastname.
193-
*
194-
* @param lastname the lastname to set
195-
*/
196154
public void setLastname(String lastname) {
197-
198155
this.lastname = lastname;
199156
}
200157

201-
/**
202-
* @return the age
203-
*/
204158
public int getAge() {
205159
return age;
206160
}
207161

208-
/**
209-
* @param age the age to set
210-
*/
211162
public void setAge(int age) {
212163
this.age = age;
213164
}
214165

215-
/**
216-
* Returns the email address.
217-
*
218-
* @return the emailAddress
219-
*/
220166
public String getEmailAddress() {
221167

222168
return emailAddress;
223169
}
224170

225-
/**
226-
* Sets the email address.
227-
*
228-
* @param emailAddress the emailAddress to set
229-
*/
230171
public void setEmailAddress(String emailAddress) {
231172

232173
this.emailAddress = emailAddress;
233174
}
234175

235-
/**
236-
* @param active the active to set
237-
*/
238176
public void setActive(boolean active) {
239177
this.active = active;
240178
}
241179

242-
/**
243-
* @return the active
244-
*/
245180
public boolean isActive() {
246181
return active;
247182
}
248183

249-
/**
250-
* Returns the user's roles.
251-
*
252-
* @return the roles
253-
*/
254184
public Set<Role> getRoles() {
255185

256186
return roles;
257187
}
258188

259-
/**
260-
* Gives the user a role. Adding a role the user already owns is a no-op.
261-
*/
262189
public void addRole(Role role) {
263190

264191
roles.add(role);
265192
}
266193

267-
/**
268-
* Revokes a role from a user.
269-
*
270-
* @param role
271-
*/
272194
public void removeRole(Role role) {
273195

274196
roles.remove(role);
275197
}
276198

277-
/**
278-
* Returns the colleagues of the user.
279-
*
280-
* @return the colleagues
281-
*/
282199
public Set<User> getColleagues() {
283200

284201
return colleagues;
285202
}
286203

287-
/**
288-
* Adds a new colleague to the user. Adding the user himself as colleague is a no-op.
289-
*
290-
* @param collegue
291-
*/
292-
public void addColleague(User collegue) {
204+
public void addColleague(User colleague) {
293205

294206
// Prevent from adding the user himself as colleague.
295-
if (this.equals(collegue)) {
207+
if (this.equals(colleague)) {
296208
return;
297209
}
298210

299-
colleagues.add(collegue);
300-
collegue.getColleagues().add(this);
211+
colleagues.add(colleague);
212+
colleague.getColleagues().add(this);
301213
}
302214

303-
/**
304-
* Removes a colleague from the list of colleagues.
305-
*
306-
* @param colleague
307-
*/
308215
public void removeColleague(User colleague) {
309216

310217
colleagues.remove(colleague);
311218
colleague.getColleagues().remove(this);
312219
}
313220

314-
/**
315-
* @return the manager
316-
*/
317221
public User getManager() {
318222

319223
return manager;
320224
}
321225

322-
/**
323-
* @param manager the manager to set
324-
*/
325226
public void setManager(User manager) {
326227

327228
this.manager = manager;
328229
}
329230

330-
/**
331-
* @return the createdAt
332-
*/
333231
public Date getCreatedAt() {
334232
return createdAt;
335233
}
336234

337-
/**
338-
* @return the address
339-
*/
340235
public Address getAddress() {
341236
return address;
342237
}
343238

344-
/**
345-
* @param address the address to set
346-
*/
347239
public void setAddress(Address address) {
348240
this.address = address;
349241
}
350242

351-
/**
352-
* @param binaryData the binaryData to set
353-
*/
354243
public void setBinaryData(byte[] binaryData) {
355244
this.binaryData = binaryData;
356245
}
357246

358-
/**
359-
* @return the binaryData
360-
*/
361247
public byte[] getBinaryData() {
362248
return binaryData;
363249
}
@@ -378,16 +264,10 @@ public boolean equals(Object obj) {
378264
return this.getId().equals(that.getId());
379265
}
380266

381-
/**
382-
* @return the attributes
383-
*/
384267
public Set<String> getAttributes() {
385268
return attributes;
386269
}
387270

388-
/**
389-
* @param attributes the attributes to set
390-
*/
391271
public void setAttributes(Set<String> attributes) {
392272
this.attributes = attributes;
393273
}
@@ -406,7 +286,6 @@ public void setCreatedAt(Date createdAt) {
406286

407287
@Override
408288
public String toString() {
409-
410289
return "User: " + getId() + ", " + getFirstname() + " " + getLastname() + ", " + getEmailAddress();
411290
}
412291
}

0 commit comments

Comments
 (0)