Skip to content

Commit ccf8fa6

Browse files
committed
Remove lombok from test cases.
Closes #1753.
1 parent bbcabbc commit ccf8fa6

13 files changed

+265
-71
lines changed

src/test/java/org/springframework/data/couchbase/core/CouchbaseTemplateQueryIntegrationTests.java

+6-7
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,13 @@
3838
import org.junit.jupiter.api.BeforeEach;
3939
import org.junit.jupiter.api.Test;
4040
import org.springframework.beans.factory.annotation.Autowired;
41-
import org.springframework.context.annotation.Configuration;
4241
import org.springframework.data.couchbase.core.query.Query;
4342
import org.springframework.data.couchbase.core.query.QueryCriteria;
4443
import org.springframework.data.couchbase.domain.Address;
4544
import org.springframework.data.couchbase.domain.Airport;
4645
import org.springframework.data.couchbase.domain.AssessmentDO;
47-
import org.springframework.data.couchbase.domain.Course;
4846
import org.springframework.data.couchbase.domain.Config;
47+
import org.springframework.data.couchbase.domain.Course;
4948
import org.springframework.data.couchbase.domain.NaiveAuditorAware;
5049
import org.springframework.data.couchbase.domain.PersonWithMaps;
5150
import org.springframework.data.couchbase.domain.Submission;
@@ -152,7 +151,7 @@ void findById() {
152151
person1.setReleaseVersions(releaseVersions);
153152
couchbaseTemplate.upsertById(PersonWithMaps.class).one(person1);
154153
PersonWithMaps person2 = couchbaseTemplate.findById(PersonWithMaps.class).one(person1.getId());
155-
assertEquals(person1, person2);
154+
assertEquals(person1, person2);
156155
couchbaseTemplate.removeById(PersonWithMaps.class).oneEntity(person1);
157156
}
158157

@@ -184,11 +183,11 @@ void findAssessmentDO() {
184183
ado = couchbaseTemplate.upsertById(AssessmentDO.class).one(ado);
185184

186185
Query specialUsers = new Query(QueryCriteria.where(i("id")).is(ado.getId()));
187-
final List<AssessmentDO> foundUsers = couchbaseTemplate.findByQuery(AssessmentDO.class)
186+
final List<AssessmentDO> assementDOs = couchbaseTemplate.findByQuery(AssessmentDO.class)
188187
.withConsistency(REQUEST_PLUS).matching(specialUsers).all();
189-
assertEquals("123", foundUsers.get(0).getId(), "id");
190-
assertEquals("44444444", foundUsers.get(0).getDocumentId(), "documentId");
191-
assertEquals(ado, foundUsers.get(0));
188+
assertEquals("123", assementDOs.get(0).getId(), "id");
189+
assertEquals("44444444", assementDOs.get(0).getDocumentId(), "documentId");
190+
assertEquals(ado, assementDOs.get(0));
192191
couchbaseTemplate.removeById(AssessmentDO.class).one(ado.getDocumentId());
193192
}
194193

src/test/java/org/springframework/data/couchbase/domain/AssessmentDO.java

+34-5
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
package org.springframework.data.couchbase.domain;
1818

19-
import lombok.Data;
20-
import lombok.NoArgsConstructor;
21-
2219
import org.springframework.data.annotation.Id;
2320
import org.springframework.data.couchbase.core.mapping.Document;
2421
import org.springframework.data.couchbase.core.mapping.Field;
@@ -30,8 +27,6 @@
3027
* @author Michael Reiche
3128
*/
3229
@Document()
33-
@Data
34-
@NoArgsConstructor
3530
public class AssessmentDO {
3631
@Id @GeneratedValue(strategy = GenerationStrategy.USE_ATTRIBUTES) private String documentId;
3732

@@ -40,4 +35,38 @@ public class AssessmentDO {
4035
@Field("docType") private String documentType;
4136

4237
@Field private String id;
38+
39+
public String getId() {
40+
return id;
41+
}
42+
43+
public String getDocumentId() {
44+
return documentId;
45+
}
46+
47+
public void setEventTimestamp(long eventTimestamp) {
48+
this.eventTimestamp = eventTimestamp;
49+
}
50+
51+
public void setId(String id) {
52+
this.id = id;
53+
}
54+
55+
public boolean equals(Object other) {
56+
if (other == null || !(other instanceof AssessmentDO)) {
57+
return false;
58+
}
59+
AssessmentDO that = (AssessmentDO) other;
60+
return equals(this.id, that.id) && equals(this.documentId, that.documentId)
61+
&& equals(this.eventTimestamp, that.eventTimestamp) && equals(this.documentType, that.documentType);
62+
}
63+
64+
boolean equals(Object s0, Object s1) {
65+
if (s0 == null && s1 == null || s0 == s1) {
66+
return true;
67+
}
68+
Object sa = s0 != null ? s0 : s1;
69+
Object sb = s0 != null ? s1 : s0;
70+
return sa.equals(sb);
71+
}
4372
}
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,42 @@
11
package org.springframework.data.couchbase.domain;
22

3-
import lombok.Getter;
4-
import lombok.Setter;
5-
import org.springframework.data.couchbase.core.mapping.Document;
6-
73
import java.util.List;
84

5+
import org.springframework.data.couchbase.core.mapping.Document;
6+
97
@Document
108
public class MutableUser extends User{
119
public MutableUser(String id, String firstname, String lastname) {
1210
super(id, firstname, lastname);
1311
}
14-
15-
@Getter
16-
@Setter
12+
1713
private Address address;
1814

19-
@Getter
20-
@Setter
2115
private MutableUser subuser;
2216

23-
@Getter
24-
@Setter
2517
private List<String> roles;
26-
27-
18+
19+
public void setRoles(List<String> roles) {
20+
this.roles = roles;
21+
}
22+
23+
public List<String> getRoles() {
24+
return roles;
25+
}
26+
27+
public void setAddress(Address address) {
28+
this.address = address;
29+
}
30+
31+
public Address getAddress() {
32+
return address;
33+
}
34+
35+
public void setSubuser(MutableUser subuser) {
36+
this.subuser = subuser;
37+
}
38+
39+
public MutableUser getSubuser() {
40+
return subuser;
41+
}
2842
}

src/test/java/org/springframework/data/couchbase/domain/PersonValue.java

+46-10
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package org.springframework.data.couchbase.domain;
1717

18-
import lombok.Value;
19-
import lombok.With;
2018
import org.springframework.data.annotation.Id;
2119
import org.springframework.data.annotation.Version;
2220
import org.springframework.data.couchbase.core.mapping.Document;
@@ -30,16 +28,13 @@
3028
* @author Michael Reiche
3129
*/
3230

33-
@Value
3431
@Document
3532
public class PersonValue {
3633
@Id @GeneratedValue(strategy = GenerationStrategy.UNIQUE)
37-
@With String id;
38-
@Version
39-
@With
40-
long version;
41-
@Field String firstname;
42-
@Field String lastname;
34+
private final String id;
35+
@Version private final long version;
36+
@Field private final String firstname;
37+
@Field private final String lastname;
4338

4439
public PersonValue(String id, long version, String firstname, String lastname) {
4540
this.id = id;
@@ -48,15 +43,56 @@ public PersonValue(String id, long version, String firstname, String lastname) {
4843
this.lastname = lastname;
4944
}
5045

46+
public PersonValue withId(String id) {
47+
return new PersonValue(id, this.version, this.firstname, this.lastname);
48+
}
49+
50+
public PersonValue withVersion(Long version) {
51+
return new PersonValue(this.id, version, this.firstname, this.lastname);
52+
}
53+
54+
public PersonValue withFirstname(String firstname) {
55+
return new PersonValue(this.id, this.version, firstname, this.lastname);
56+
}
57+
58+
public PersonValue withLastname(String lastname) {
59+
return new PersonValue(this.id, this.version, this.firstname, lastname);
60+
}
61+
5162
public String toString() {
5263
StringBuilder sb = new StringBuilder();
5364
sb.append("PersonValue : {");
54-
sb.append(" id : " + getId());
65+
sb.append(" id : " + id);
5566
sb.append(", version : " + version);
5667
sb.append(", firstname : " + firstname);
5768
sb.append(", lastname : " + lastname);
5869
sb.append(" }");
5970
return sb.toString();
6071
}
6172

73+
public String getId() {
74+
return id;
75+
}
76+
77+
public long getVersion() {
78+
return version;
79+
}
80+
81+
public boolean equals(Object other) {
82+
if (other == null || !(other instanceof PersonValue)) {
83+
return false;
84+
}
85+
PersonValue that = (PersonValue) other;
86+
return equals(this.getId(), that.getId()) && equals(this.version, that.version)
87+
&& equals(this.firstname, that.firstname) && equals(this.lastname, that.lastname);
88+
}
89+
90+
boolean equals(Object s0, Object s1) {
91+
if (s0 == null && s1 == null || s0 == s1) {
92+
return true;
93+
}
94+
Object sa = s0 != null ? s0 : s1;
95+
Object sb = s0 != null ? s1 : s0;
96+
return sa.equals(sb);
97+
}
6298
}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package org.springframework.data.couchbase.domain;
22

3-
import com.couchbase.client.core.deps.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4-
import com.fasterxml.jackson.annotation.JsonInclude;
5-
import lombok.Data;
3+
import java.util.Map;
4+
import java.util.Set;
5+
66
import org.springframework.data.annotation.Id;
77
import org.springframework.data.couchbase.core.mapping.Document;
88
import org.springframework.data.couchbase.core.mapping.Field;
99

10-
import java.util.Map;
11-
import java.util.Set;
10+
import com.couchbase.client.core.deps.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
11+
import com.fasterxml.jackson.annotation.JsonInclude;
1212

13-
@Data
1413
@JsonIgnoreProperties(ignoreUnknown = true)
1514
@JsonInclude(JsonInclude.Include.NON_NULL)
1615
@Document
@@ -24,6 +23,40 @@ public class PersonWithMaps {
2423
private Map<String, Map<String,String>> releaseVersions;
2524

2625
public PersonWithMaps(){
26+
}
2727

28+
public void setId(String id) {
29+
this.id = id;
2830
}
31+
32+
public void setVersions(Map<String, Set<String>> versions) {
33+
this.versions = versions;
34+
}
35+
36+
public void setReleaseVersions(Map<String, Map<String, String>> releaseVersions) {
37+
this.releaseVersions = releaseVersions;
38+
}
39+
40+
public String getId() {
41+
return id;
42+
}
43+
44+
public boolean equals(Object other) {
45+
if (other == null || !(other instanceof PersonWithMaps)) {
46+
return false;
47+
}
48+
PersonWithMaps that = (PersonWithMaps) other;
49+
return equals(this.getId(), that.getId()) && equals(this.versions, that.versions)
50+
&& equals(this.releaseVersions, that.releaseVersions);
51+
}
52+
53+
boolean equals(Object s0, Object s1) {
54+
if (s0 == null && s1 == null || s0 == s1) {
55+
return true;
56+
}
57+
Object sa = s0 != null ? s0 : s1;
58+
Object sb = s0 != null ? s1 : s0;
59+
return sa.equals(sb);
60+
}
61+
2962
}

src/test/java/org/springframework/data/couchbase/domain/SubscriptionToken.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
package org.springframework.data.couchbase.domain;
1818

19-
import lombok.EqualsAndHashCode;
20-
import lombok.Getter;
21-
import lombok.ToString;
2219
import org.springframework.data.annotation.Id;
2320
import org.springframework.data.annotation.Version;
2421
import org.springframework.data.couchbase.core.mapping.Document;
@@ -31,9 +28,6 @@
3128
*
3229
* @author Michael Reiche
3330
*/
34-
@Getter
35-
@ToString
36-
@EqualsAndHashCode
3731
@Document
3832
public class SubscriptionToken {
3933
private @Id
@@ -72,4 +66,12 @@ public SubscriptionToken(
7266
public void setType(String type) {
7367
type = type;
7468
}
69+
70+
public long getVersion() {
71+
return version;
72+
}
73+
74+
public String getId() {
75+
return id;
76+
}
7577
}

src/test/java/org/springframework/data/couchbase/domain/UserSubmission.java

+39-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.data.couchbase.domain;
1818

19-
import lombok.Data;
20-
2119
import java.util.List;
2220

2321
import org.springframework.data.annotation.TypeAlias;
@@ -31,7 +29,6 @@
3129
*
3230
* @author Michael Reiche
3331
*/
34-
@Data
3532
@Document
3633
@TypeAlias("user")
3734
@CompositeQueryIndex(fields = { "id", "username", "email" })
@@ -56,4 +53,43 @@ public void setCourses(List<Course> courses) {
5653
this.courses = courses;
5754
}
5855

56+
public void setId(String id) {
57+
this.id = id;
58+
}
59+
60+
public void setUsername(String username) {
61+
this.username = username;
62+
}
63+
64+
public String getId() {
65+
return id;
66+
}
67+
68+
public Address getAddress() {
69+
return address;
70+
}
71+
72+
public List<Course> getCourses() {
73+
return courses;
74+
}
75+
76+
public String getUsername() {
77+
return username;
78+
}
79+
80+
public List<Address> getOtherAddresses() {
81+
return otherAddresses;
82+
}
83+
84+
public List<Submission> getSubmissions() {
85+
return submissions;
86+
}
87+
88+
public void setRoles(List<String> roles) {
89+
this.roles = roles;
90+
}
91+
92+
public void setAddress(Address address) {
93+
this.address = address;
94+
}
5995
}

0 commit comments

Comments
 (0)