@@ -174,8 +174,6 @@ public void isMapOrTest() {
174174
175175 @ Test
176176 public void asStringTest () {
177- assumeTrue (serverVersionLessThan (8 , 2 )); // TODO JAVA-5960
178-
179177 // https://www.mongodb.com/docs/manual/reference/operator/aggregation/toString/
180178 // asString, since toString conflicts
181179 assertExpression ("false" , of (false ).asString (), "{'$toString': [false]}" );
@@ -189,14 +187,25 @@ public void asStringTest() {
189187
190188 // this is equivalent to $dateToString
191189 assertExpression ("1970-01-01T00:00:00.123Z" , of (Instant .ofEpochMilli (123 )).asString ());
190+ }
191+
192+ @ Test
193+ public void asStringTestNestedPre82 () {
194+ assumeTrue (serverVersionLessThan (8 , 2 ));
192195
193196 // Arrays and documents are not (yet) supported:
194197 assertThrows (MongoCommandException .class , () ->
195- assertExpression ("[]" , ofIntegerArray (1 , 2 ).asString ()));
196- assertThrows (MongoCommandException .class , () ->
197- assertExpression ("[1, 2]" , ofIntegerArray (1 , 2 ).asString ()));
198+ assertExpression ("[1,2]" , ofIntegerArray (1 , 2 ).asString ()));
198199 assertThrows (MongoCommandException .class , () ->
199- assertExpression ("{a: 1}" , of (Document .parse ("{a: 1}" )).asString ()));
200+ assertExpression ("{\" a\" :1}" , of (Document .parse ("{a: 1}" )).asString ()));
201+ }
202+
203+ @ Test
204+ public void asStringTestNested () {
205+ assumeTrue (serverVersionAtLeast (8 , 2 ));
206+
207+ assertExpression ("[1,2]" , ofIntegerArray (1 , 2 ).asString ());
208+ assertExpression ("{\" a\" :1}" , of (Document .parse ("{a: 1}" )).asString ());
200209 }
201210
202211 @ Test
0 commit comments