20
20
import java .util .Arrays ;
21
21
22
22
import org .bson .Document ;
23
- import org .junit .Before ;
24
- import org .junit .Ignore ;
25
- import org .junit .Test ;
23
+ import org .junit .jupiter . api . BeforeEach ;
24
+ import org .junit .jupiter . api . Disabled ;
25
+ import org .junit .jupiter . api . Test ;
26
26
import org .springframework .data .mongodb .core .Person ;
27
27
28
28
/**
@@ -38,8 +38,8 @@ public class SpelExpressionTransformerUnitTests {
38
38
39
39
Data data ;
40
40
41
- @ Before
42
- public void setup () {
41
+ @ BeforeEach
42
+ public void beforeEach () {
43
43
44
44
this .data = new Data ();
45
45
this .data .primitiveLongValue = 42 ;
@@ -108,7 +108,7 @@ public void shouldRenderNestedFieldReference() {
108
108
}
109
109
110
110
@ Test // DATAMONGO-774
111
- @ Ignore
111
+ @ Disabled
112
112
public void shouldRenderNestedIndexedFieldReference () {
113
113
114
114
// TODO add support for rendering nested indexed field references
@@ -161,23 +161,25 @@ public void shouldRenderParameterExpressionResults() {
161
161
}
162
162
163
163
@ Test // DATAMONGO-774
164
- @ Ignore ("TODO: mongo3 renders this a bit strange" )
165
164
public void shouldRenderNestedParameterExpressionResults () {
166
165
167
166
assertThat (
168
167
((Document ) transform ("[0].primitiveLongValue + [0].primitiveDoubleValue + [0].doubleValue.longValue()" , data ))
169
- .toJson ()).isEqualTo (Document .parse ("{ \" $add\" : [ 42 , 1.2345 , 23]}" ).toJson ());
168
+ .toJson ())
169
+ .isEqualTo (Document
170
+ .parse ("{ \" $add\" : [ { $numberLong : \" 42\" } , 1.2345 , { $numberLong : \" 23\" } ]}" ).toJson ());
170
171
}
171
172
172
173
@ Test // DATAMONGO-774
173
- @ Ignore ("TODO: mongo3 renders this a bit strange" )
174
174
public void shouldRenderNestedParameterExpressionResultsInNestedExpressions () {
175
175
176
176
assertThat (
177
177
((Document ) transform ("((1 + [0].primitiveLongValue) + [0].primitiveDoubleValue) * [0].doubleValue.longValue()" ,
178
- data )).toJson ()).isEqualTo (
179
- new Document ("$multiply" , Arrays .asList (new Document ("$add" , Arrays .asList (1 , 42L , 1.2345D , 23L ))))
180
- .toJson ());
178
+ data )).toJson ())
179
+ .isEqualTo (new Document ("$multiply" ,
180
+ Arrays .<Object > asList (
181
+ new Document ("$add" , Arrays .<Object > asList (1 , new Document ("$numberLong" , "42" ), 1.2345D )),
182
+ new Document ("$numberLong" , "23" ))).toJson ());
181
183
}
182
184
183
185
@ Test // DATAMONGO-840
@@ -680,9 +682,8 @@ public void shouldRenderMethodReferenceReverseArray() {
680
682
}
681
683
682
684
@ Test // DATAMONGO-1548
683
- @ Ignore ("Document API cannot render String[]" )
684
685
public void shouldRenderMethodReferenceReduce () {
685
- assertThat (transform ("reduce(field, '', {'$concat':new String[] {'$$value','$$this'}})" )).isEqualTo (Document .parse (
686
+ assertThat (transform ("reduce(field, '', {'$concat':{'$$value','$$this'}})" )).isEqualTo (Document .parse (
686
687
"{ \" $reduce\" : { \" input\" : \" $field\" , \" initialValue\" : \" \" , \" in\" : { \" $concat\" : [ \" $$value\" , \" $$this\" ]}}}" ));
687
688
}
688
689
0 commit comments