Skip to content

Commit e40e2a4

Browse files
committed
Fix test entities for @PersistenceConstructor
1 parent 481dec4 commit e40e2a4

File tree

1 file changed

+40
-15
lines changed

1 file changed

+40
-15
lines changed

spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/store/AbstractMongoDbMessageStoreTests.java

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@
3131
import org.hamcrest.Matchers;
3232
import org.junit.Test;
3333

34+
import org.springframework.data.annotation.PersistenceConstructor;
3435
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
3536
import org.springframework.integration.channel.DirectChannel;
3637
import org.springframework.integration.history.MessageHistory;
@@ -275,10 +276,12 @@ public void testAddAndUpdateAlreadySaved() throws Exception {
275276
}
276277

277278
public static class Foo implements Serializable {
279+
278280
/**
279281
*
280282
*/
281283
private static final long serialVersionUID = 1L;
284+
282285
private String name;
283286

284287
public String getName() {
@@ -291,10 +294,12 @@ public void setName(String name) {
291294
}
292295

293296
public static class Bar implements Serializable {
297+
294298
/**
295299
*
296300
*/
297301
private static final long serialVersionUID = 1L;
302+
298303
private final String name;
299304

300305
public Bar(String name) {
@@ -307,26 +312,41 @@ public String getName() {
307312
}
308313

309314
public static class Baz implements Serializable {
310-
/**
311-
*
312-
*/
315+
313316
private static final long serialVersionUID = 1L;
314-
private final String name = "baz";
317+
318+
private final String name;
319+
320+
Baz() {
321+
this("baz");
322+
}
323+
324+
@PersistenceConstructor
325+
Baz(String name) {
326+
this.name = name;
327+
}
315328

316329
public String getName() {
317330
return name;
318331
}
332+
319333
}
320334

321335
public static class Abc implements Serializable {
322-
/**
323-
*
324-
*/
336+
325337
private static final long serialVersionUID = 1L;
326338

327-
private final String name = "abx";
339+
private final String name;
340+
341+
Abc() {
342+
this("abx");
343+
}
344+
345+
@PersistenceConstructor
346+
Abc(String name) {
347+
this.name = name;
348+
}
328349

329-
Abc() { }
330350

331351
public String getName() {
332352
return name;
@@ -335,15 +355,20 @@ public String getName() {
335355
}
336356

337357
public static class Xyz implements Serializable {
338-
/**
339-
*
340-
*/
358+
341359
private static final long serialVersionUID = 1L;
342360

343361
@SuppressWarnings("unused")
344-
private final String name = "xyz";
362+
private final String name;
345363

346-
Xyz() { }
364+
Xyz() {
365+
this("xyz");
366+
}
367+
368+
@PersistenceConstructor
369+
Xyz(String name) {
370+
this.name = name;
371+
}
347372

348373
}
349374

0 commit comments

Comments
 (0)