use of com.mongodb.BasicDBList in project spring-data-mongodb by spring-projects.
the class MappingMongoConverterUnitTests method readsEnumCollectionsCorrectly.
// DATAMONGO-209
@Test
void readsEnumCollectionsCorrectly() {
BasicDBList enums = new BasicDBList();
enums.add("FIRST");
org.bson.Document document = new org.bson.Document("enums", enums);
ClassWithEnumProperty result = converter.read(ClassWithEnumProperty.class, document);
assertThat(result.enums).isInstanceOf(List.class);
assertThat(result.enums.size()).isEqualTo(1);
assertThat(result.enums).contains(SampleEnum.FIRST);
}
use of com.mongodb.BasicDBList in project spring-data-mongodb by spring-projects.
the class MappingMongoConverterUnitTests method resolvesNestedComplexTypeForConstructorCorrectly.
@Test
void resolvesNestedComplexTypeForConstructorCorrectly() {
org.bson.Document address = new org.bson.Document("street", "110 Southwark Street");
address.put("city", "London");
BasicDBList addresses = new BasicDBList();
addresses.add(address);
org.bson.Document person = new org.bson.Document("firstname", "Oliver");
person.put("addresses", addresses);
Person result = converter.read(Person.class, person);
assertThat(result.addresses).isNotNull();
}
use of com.mongodb.BasicDBList in project spring-data-mongodb by spring-projects.
the class MappingMongoConverterUnitTests method readsMapOfObjectsListValuesCorrectly.
// DATAMONGO-235
@Test
void readsMapOfObjectsListValuesCorrectly() {
BasicDBList list = new BasicDBList();
list.add("Bar");
org.bson.Document source = new org.bson.Document("mapOfObjects", new org.bson.Document("Foo", list));
ClassWithMapProperty result = converter.read(ClassWithMapProperty.class, source);
assertThat(result.mapOfObjects).isNotNull();
}
use of com.mongodb.BasicDBList in project spring-data-mongodb by spring-projects.
the class MappingMongoConverterUnitTests method readsEnumSetCorrectly.
// DATAMONGO-833
@Test
void readsEnumSetCorrectly() {
BasicDBList enumSet = new BasicDBList();
enumSet.add("SECOND");
org.bson.Document document = new org.bson.Document("enumSet", enumSet);
ClassWithEnumProperty result = converter.read(ClassWithEnumProperty.class, document);
assertThat(result.enumSet).isInstanceOf(EnumSet.class);
assertThat(result.enumSet.size()).isEqualTo(1);
assertThat(result.enumSet).contains(SampleEnum.SECOND);
}
use of com.mongodb.BasicDBList in project spring-data-mongodb by spring-projects.
the class MappingMongoConverterUnitTests method readsMapListValuesCorrectly.
// DATAMONGO-235
@Test
void readsMapListValuesCorrectly() {
BasicDBList list = new BasicDBList();
list.add("Bar");
org.bson.Document source = new org.bson.Document("mapOfLists", new org.bson.Document("Foo", list));
ClassWithMapProperty result = converter.read(ClassWithMapProperty.class, source);
assertThat(result.mapOfLists).isNotNull();
}
Aggregations