From 9fb1a9e63af997100fee5987505664f8a273ce97 Mon Sep 17 00:00:00 2001 From: Thomas Risberg Date: Wed, 6 Apr 2011 12:37:50 -0400 Subject: [PATCH] added additional test without generated id for testPersonWithCustomIdName --- .../data/document/mongodb/mapping/MappingTests.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/mapping/MappingTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/mapping/MappingTests.java index de48e5bfe..e224aa5d4 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/mapping/MappingTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/mapping/MappingTests.java @@ -104,7 +104,17 @@ public class MappingTests { List result = template.find(new Query(Criteria.where("ssn").is(123456)), PersonCustomIdName.class); assertThat(result.size(), is(1)); - assertThat(result.get(0).getLastName(), is("LastName")); + assertNotNull(result.get(0).getLastName()); + + PersonCustomIdName p2 = new PersonCustomIdName(654321, "Custom Id"); + p2.setLastName("Smith"); + template.insert(p2); + + List result2 = template.find(new Query(Criteria.where("ssn").is(654321)), PersonCustomIdName.class); + assertThat(result2.size(), is(1)); + assertNotNull(result2.get(0).getLastName()); + assertThat(result2.get(0).getLastName(), is("Smith")); + } @Test