Add regression test for LazyDBObject#toString
@@ -78,6 +78,19 @@ class LazyDBObjectSpecification extends Specification {
document['f'] == new DBRef('mydb', 'a.b', new ObjectId('123456789012345678901234'))
}
+ def testToString() throws IOException {
+ given:
+ DBObject origDoc = new BasicDBObject('x', true);
+ encoder.putObject(origDoc);
+ buf.pipe(bios);
+
+ when:
+ DBObject doc = lazyDBDecoder.decode(new ByteArrayInputStream(bios.toByteArray()), (DBCollection) null);
+
+ then:
+ doc.toString() == '{"x": true}'
+ }
+
def testDecodeAllTypes() throws IOException {
given:
DBObject origDoc = getTestDocument();
