Skip to content

Commit c5674d9

Browse files
Delombok test source.
Closes: #4411
1 parent 048af85 commit c5674d9

File tree

85 files changed

+7034
-622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+7034
-622
lines changed

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/ReactiveTransactionIntegrationTests.java

+104-9
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@
1515
*/
1616
package org.springframework.data.mongodb;
1717

18-
import lombok.AllArgsConstructor;
19-
import lombok.Data;
20-
import lombok.RequiredArgsConstructor;
2118
import reactor.core.publisher.Flux;
2219
import reactor.core.publisher.Mono;
2320
import reactor.test.StepVerifier;
2421

2522
import java.time.Duration;
2623
import java.util.Collections;
24+
import java.util.Objects;
2725
import java.util.Set;
2826

2927
import org.bson.types.ObjectId;
@@ -33,7 +31,6 @@
3331
import org.junit.jupiter.api.Test;
3432
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
3533
import org.junit.jupiter.api.extension.ExtendWith;
36-
3734
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
3835
import org.springframework.context.annotation.Bean;
3936
import org.springframework.context.annotation.Configuration;
@@ -247,12 +244,17 @@ protected Set<Class<?>> getInitialEntitySet() {
247244
}
248245
}
249246

250-
@RequiredArgsConstructor
251247
static class PersonService {
252248

253249
final ReactiveMongoOperations operations;
254250
final ReactiveMongoTransactionManager manager;
255251

252+
PersonService(ReactiveMongoOperations operations, ReactiveMongoTransactionManager manager) {
253+
254+
this.operations = operations;
255+
this.manager = manager;
256+
}
257+
256258
public Mono<Person> savePersonErrors(Person person) {
257259

258260
TransactionalOperator transactionalOperator = TransactionalOperator.create(manager,
@@ -336,20 +338,113 @@ public Flux<Person> declarativeSavePersonErrors(Person person) {
336338
}
337339
}
338340

339-
@Data
340-
@AllArgsConstructor
341341
@Document("person-rx")
342342
static class Person {
343343

344344
ObjectId id;
345345
String firstname, lastname;
346+
347+
Person(ObjectId id, String firstname, String lastname) {
348+
this.id = id;
349+
this.firstname = firstname;
350+
this.lastname = lastname;
351+
}
352+
353+
public ObjectId getId() {
354+
return this.id;
355+
}
356+
357+
public String getFirstname() {
358+
return this.firstname;
359+
}
360+
361+
public String getLastname() {
362+
return this.lastname;
363+
}
364+
365+
public void setId(ObjectId id) {
366+
this.id = id;
367+
}
368+
369+
public void setFirstname(String firstname) {
370+
this.firstname = firstname;
371+
}
372+
373+
public void setLastname(String lastname) {
374+
this.lastname = lastname;
375+
}
376+
377+
@Override
378+
public boolean equals(Object o) {
379+
380+
if (this == o) {
381+
return true;
382+
}
383+
if (o == null || getClass() != o.getClass()) {
384+
return false;
385+
}
386+
Person person = (Person) o;
387+
return Objects.equals(id, person.id) && Objects.equals(firstname, person.firstname)
388+
&& Objects.equals(lastname, person.lastname);
389+
}
390+
391+
@Override
392+
public int hashCode() {
393+
return Objects.hash(id, firstname, lastname);
394+
}
395+
396+
public String toString() {
397+
return "ReactiveTransactionIntegrationTests.Person(id=" + this.getId() + ", firstname=" + this.getFirstname()
398+
+ ", lastname=" + this.getLastname() + ")";
399+
}
346400
}
347401

348-
@Data
349-
@AllArgsConstructor
350402
static class EventLog {
351403

352404
ObjectId id;
353405
String action;
406+
407+
public EventLog(ObjectId id, String action) {
408+
this.id = id;
409+
this.action = action;
410+
}
411+
412+
public ObjectId getId() {
413+
return this.id;
414+
}
415+
416+
public String getAction() {
417+
return this.action;
418+
}
419+
420+
public void setId(ObjectId id) {
421+
this.id = id;
422+
}
423+
424+
public void setAction(String action) {
425+
this.action = action;
426+
}
427+
428+
@Override
429+
public boolean equals(Object o) {
430+
431+
if (this == o) {
432+
return true;
433+
}
434+
if (o == null || getClass() != o.getClass()) {
435+
return false;
436+
}
437+
EventLog eventLog = (EventLog) o;
438+
return Objects.equals(id, eventLog.id) && Objects.equals(action, eventLog.action);
439+
}
440+
441+
@Override
442+
public int hashCode() {
443+
return Objects.hash(id, action);
444+
}
445+
446+
public String toString() {
447+
return "ReactiveTransactionIntegrationTests.EventLog(id=" + this.getId() + ", action=" + this.getAction() + ")";
448+
}
354449
}
355450
}

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/ClientSessionTests.java

+80-6
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
import static org.springframework.data.mongodb.core.query.Criteria.*;
2020
import static org.springframework.data.mongodb.core.query.Query.*;
2121

22-
import lombok.AllArgsConstructor;
23-
import lombok.Data;
22+
import java.util.Objects;
2423

2524
import org.bson.Document;
2625
import org.junit.jupiter.api.BeforeEach;
@@ -177,23 +176,98 @@ void shouldBeAbleToReadDbRefDuringTransaction() {
177176
session.abortTransaction();
178177
}
179178

180-
@Data
181-
@AllArgsConstructor
182179
@org.springframework.data.mongodb.core.mapping.Document(COLLECTION_NAME)
183180
static class SomeDoc {
184181

185182
@Id String id;
186183
String value;
184+
185+
SomeDoc(String id, String value) {
186+
187+
this.id = id;
188+
this.value = value;
189+
}
190+
191+
public String getId() {
192+
return this.id;
193+
}
194+
195+
public String getValue() {
196+
return this.value;
197+
}
198+
199+
public void setId(String id) {
200+
this.id = id;
201+
}
202+
203+
public void setValue(String value) {
204+
this.value = value;
205+
}
206+
207+
@Override
208+
public boolean equals(Object o) {
209+
210+
if (this == o) {
211+
return true;
212+
}
213+
if (o == null || getClass() != o.getClass()) {
214+
return false;
215+
}
216+
SomeDoc someDoc = (SomeDoc) o;
217+
return Objects.equals(id, someDoc.id) && Objects.equals(value, someDoc.value);
218+
}
219+
220+
@Override
221+
public int hashCode() {
222+
return Objects.hash(id, value);
223+
}
224+
225+
public String toString() {
226+
return "ClientSessionTests.SomeDoc(id=" + this.getId() + ", value=" + this.getValue() + ")";
227+
}
187228
}
188229

189-
@Data
190-
@AllArgsConstructor
191230
@org.springframework.data.mongodb.core.mapping.Document(REF_COLLECTION_NAME)
192231
static class WithDbRef {
193232

194233
@Id String id;
195234
String value;
196235
@DBRef SomeDoc someDocRef;
236+
237+
WithDbRef(String id, String value, SomeDoc someDocRef) {
238+
this.id = id;
239+
this.value = value;
240+
this.someDocRef = someDocRef;
241+
}
242+
243+
public String getId() {
244+
return this.id;
245+
}
246+
247+
public String getValue() {
248+
return this.value;
249+
}
250+
251+
public SomeDoc getSomeDocRef() {
252+
return this.someDocRef;
253+
}
254+
255+
public void setId(String id) {
256+
this.id = id;
257+
}
258+
259+
public void setValue(String value) {
260+
this.value = value;
261+
}
262+
263+
public void setSomeDocRef(SomeDoc someDocRef) {
264+
this.someDocRef = someDocRef;
265+
}
266+
267+
public String toString() {
268+
return "ClientSessionTests.WithDbRef(id=" + this.getId() + ", value=" + this.getValue() + ", someDocRef="
269+
+ this.getSomeDocRef() + ")";
270+
}
197271
}
198272

199273
}

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultIndexOperationsUnitTests.java

+15-4
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,13 @@
1818
import static org.assertj.core.api.Assertions.*;
1919
import static org.mockito.Mockito.*;
2020

21-
import lombok.Data;
22-
2321
import org.bson.Document;
2422
import org.junit.jupiter.api.BeforeEach;
2523
import org.junit.jupiter.api.Test;
2624
import org.junit.jupiter.api.extension.ExtendWith;
2725
import org.mockito.ArgumentCaptor;
2826
import org.mockito.Mock;
2927
import org.mockito.junit.jupiter.MockitoExtension;
30-
3128
import org.springframework.data.domain.Sort.Direction;
3229
import org.springframework.data.mongodb.MongoDatabaseFactory;
3330
import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
@@ -128,9 +125,23 @@ private DefaultIndexOperations indexOpsFor(Class<?> type) {
128125
return new DefaultIndexOperations(template, template.getCollectionName(type), type);
129126
}
130127

131-
@Data
132128
static class Jedi {
129+
133130
@Field("firstname") String name;
131+
132+
public Jedi() {}
133+
134+
public String getName() {
135+
return this.name;
136+
}
137+
138+
public void setName(String name) {
139+
this.name = name;
140+
}
141+
142+
public String toString() {
143+
return "DefaultIndexOperationsUnitTests.Jedi(name=" + this.getName() + ")";
144+
}
134145
}
135146

136147
@org.springframework.data.mongodb.core.mapping.Document(collation = "de_AT")

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/DefaultReactiveIndexOperationsUnitTests.java

+15-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import static org.assertj.core.api.Assertions.*;
1919
import static org.mockito.Mockito.*;
2020

21-
import lombok.Data;
2221
import reactor.core.publisher.Mono;
2322

2423
import org.bson.Document;
@@ -29,7 +28,6 @@
2928
import org.mockito.Mock;
3029
import org.mockito.junit.jupiter.MockitoExtension;
3130
import org.reactivestreams.Publisher;
32-
3331
import org.springframework.data.domain.Sort.Direction;
3432
import org.springframework.data.mongodb.ReactiveMongoDatabaseFactory;
3533
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
@@ -116,9 +114,23 @@ private DefaultReactiveIndexOperations indexOpsFor(Class<?> type) {
116114
new QueryMapper(template.getConverter()), type);
117115
}
118116

119-
@Data
120117
static class Jedi {
118+
121119
@Field("firstname") String name;
120+
121+
public Jedi() {}
122+
123+
public String getName() {
124+
return this.name;
125+
}
126+
127+
public void setName(String name) {
128+
this.name = name;
129+
}
130+
131+
public String toString() {
132+
return "DefaultReactiveIndexOperationsUnitTests.Jedi(name=" + this.getName() + ")";
133+
}
122134
}
123135

124136
@org.springframework.data.mongodb.core.mapping.Document(collation = "de_AT")

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/EntityOperationsUnitTests.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717

1818
import static org.assertj.core.api.Assertions.*;
1919

20-
import lombok.AllArgsConstructor;
21-
import lombok.NoArgsConstructor;
22-
2320
import java.time.Instant;
2421
import java.util.Map;
2522

@@ -162,8 +159,6 @@ static class InvalidMetaField {
162159
Instant time;
163160
}
164161

165-
@AllArgsConstructor
166-
@NoArgsConstructor
167162
class WithNestedDocument {
168163

169164
String id;
@@ -172,9 +167,18 @@ class WithNestedDocument {
172167

173168
Document document;
174169

170+
public WithNestedDocument() {}
171+
175172
public WithNestedDocument(String id) {
176173
this.id = id;
177174
}
175+
176+
public WithNestedDocument(String id, WithNestedDocument nested, Document document) {
177+
178+
this.id = id;
179+
this.nested = nested;
180+
this.document = document;
181+
}
178182
}
179183

180184
interface ProjectionInterface {

0 commit comments

Comments
 (0)