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 e224aa5d4..6529d3d94 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 @@ -99,21 +99,20 @@ public class MappingTests { // POJOs aren't auto-detected, have to add manually mappingContext.addPersistentEntity(PersonCustomIdName.class); - PersonCustomIdName p = new PersonCustomIdName(123456, "Custom Id", "LastName"); + PersonCustomIdName p = new PersonCustomIdName(123456, "Custom Id", null); template.insert(p); List result = template.find(new Query(Criteria.where("ssn").is(123456)), PersonCustomIdName.class); assertThat(result.size(), is(1)); assertNotNull(result.get(0).getLastName()); - PersonCustomIdName p2 = new PersonCustomIdName(654321, "Custom Id"); - p2.setLastName("Smith"); + PersonCustomIdName p2 = new PersonCustomIdName(654321, "Custom Id", "LastName"); 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")); + assertThat(result2.get(0).getLastName(), is("LastName")); }