@@ -10,15 +10,16 @@ import org.apache.lucene.search.MatchAllDocsQuery
1010class DocumentIncludesSuite extends FunSuite with DocumentIncludes {
1111
1212 test(" mapToBson should convert Map to Bson" ) {
13- val map = Map (" key" -> " value" )
13+ val map = Map (" key" -> " value" )
1414 val bson = mapToBson(map)
1515 assert(bson.isInstanceOf [Document ])
16+ assertEquals(bson.toBsonDocument.toJson(), " {\" key\" :\" value\" }" )
1617 assertEquals(bson.asInstanceOf [Document ].getString(" key" ), " value" )
1718 }
1819
1920 test(" luceneQueryBson should convert Lucene Query to Bson" ) {
2021 val query = new MatchAllDocsQuery ()
21- val bson = luceneQueryBson(query)
22+ val bson = luceneQueryBson(query)
2223 assert(bson.isInstanceOf [Document ])
2324 }
2425
@@ -27,55 +28,59 @@ class DocumentIncludesSuite extends FunSuite with DocumentIncludes {
2728 javaMap.put(" key" , " value" )
2829 val document = documentFromJavaMap(javaMap)
2930 assert(document.isInstanceOf [Document ])
31+ assertEquals(document.toBsonDocument.toJson(), " {\" key\" :\" value\" }" )
3032 assertEquals(document.getString(" key" ), " value" )
3133 }
3234
3335 test(" documentFromMutableMap should convert mutable.Map to Document" ) {
3436 val mutableMap : collection.mutable.Map [String , Any ] = collection.mutable.Map (" key" -> " value" )
35- val document = documentFromMutableMap(mutableMap)
37+ val document = documentFromMutableMap(mutableMap)
3638 assert(document.isInstanceOf [Document ])
39+ assertEquals(document.toBsonDocument.toJson(), " {\" key\" :\" value\" }" )
3740 assertEquals(document.getString(" key" ), " value" )
3841 }
3942
4043 test(" documentFromScalaMap should convert Map to Document" ) {
41- val map = Map (" key" -> " value" )
44+ val map = Map (" key" -> " value" )
4245 val document = documentFromScalaMap(map)
4346 assert(document.isInstanceOf [Document ])
47+ assertEquals(document.toBsonDocument.toJson(), " {\" key\" :\" value\" }" )
4448 assertEquals(document.getString(" key" ), " value" )
4549 }
4650
4751 test(" documentFromDocument should convert org.bson.Document to Document" ) {
48- val bsonDoc = new org.bson.Document (" key" , " value" )
52+ val bsonDoc = new org.bson.Document (" key" , " value" )
4953 val document = documentFromDocument(bsonDoc)
5054 assert(document.isInstanceOf [Document ])
55+ assertEquals(document.toBsonDocument.toJson(), " {\" key\" :\" value\" }" )
5156 assertEquals(document.getString(" key" ), " value" )
5257 }
5358
5459 test(" mapFromDocument should convert Document to Map" ) {
5560 val document = Document (" key" -> " value" )
56- val map = mapFromDocument(document)
61+ val map = mapFromDocument(document)
5762 assert(map.isInstanceOf [Map [_, _]])
5863 assertEquals(map(" key" ), " value" )
5964 }
6065
6166 test(" mapListFromDocuments should convert List of Documents to List of Maps" ) {
6267 val documents = List (Document (" key" -> " value" ))
63- val mapList = mapListFromDocuments(documents)
68+ val mapList = mapListFromDocuments(documents)
6469 assert(mapList.isInstanceOf [List [_]])
6570 assertEquals(mapList.head(" key" ), " value" )
6671 }
6772
6873 test(" stringToObjectId should convert String to ObjectId" ) {
69- val str = " 507f1f77bcf86cd799439011"
74+ val str = " 507f1f77bcf86cd799439011"
7075 val objectId = stringToObjectId(str)
7176 assert(objectId.isInstanceOf [ObjectId ])
7277 assertEquals(objectId.toHexString, str)
7378 }
7479
7580 test(" documentToObjectId should extract ObjectId from Document" ) {
76- val objectId = new ObjectId ()
77- val document = Document (DatabaseProvider .ObjectIdKey -> objectId)
81+ val objectId = new ObjectId ()
82+ val document = Document (DatabaseProvider .ObjectIdKey -> objectId)
7883 val extractedObjectId = documentToObjectId(document)
7984 assertEquals(extractedObjectId, objectId)
8085 }
81- }
86+ }
0 commit comments