use of org.springframework.data.mongodb.core.MongoTemplateTests.VersionedPerson in project spring-data-mongodb by spring-projects.
the class ReactiveMongoTemplateTests method nullsPropertiesForVersionObjectUpdates.
// DATAMONGO-1444
@Test
void nullsPropertiesForVersionObjectUpdates() {
VersionedPerson person = new VersionedPerson();
person.firstname = "Dave";
person.lastname = "Matthews";
//
template.save(person).as(//
StepVerifier::create).expectNextCount(//
1).verifyComplete();
assertThat(person.id).isNotNull();
person.lastname = null;
//
template.save(person).as(//
StepVerifier::create).expectNextCount(//
1).verifyComplete();
//
template.findOne(query(where("id").is(person.id)), VersionedPerson.class).as(//
StepVerifier::create).consumeNextWith(actual -> {
assertThat(actual.lastname).isNull();
}).verifyComplete();
}
Aggregations