use of org.springframework.data.mongodb.core.convert.DocumentAccessorUnitTests.ProjectingType in project spring-data-mongodb by spring-projects.
the class MappingMongoConverterUnitTests method writesProjectingTypeCorrectly.
// DATAMONGO-766
@Test
void writesProjectingTypeCorrectly() {
NestedType nested = new NestedType();
nested.c = "C";
ProjectingType type = new ProjectingType();
type.name = "name";
type.foo = "bar";
type.a = nested;
org.bson.Document result = new org.bson.Document();
converter.write(type, result);
assertThat(result.get("name")).isEqualTo((Object) "name");
org.bson.Document aValue = DocumentTestUtils.getAsDocument(result, "a");
assertThat(aValue.get("b")).isEqualTo((Object) "bar");
assertThat(aValue.get("c")).isEqualTo((Object) "C");
}
Aggregations