1
1
/*
2
- * Copyright 2013-2021 the original author or authors.
2
+ * Copyright 2013-2022 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -1208,7 +1208,7 @@ void mapNestedStringFieldCorrectly() {
1208
1208
Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1209
1209
context .getPersistentEntity (EntityWithNestedMap .class ));
1210
1210
1211
- assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" ,new org .bson .Document ("levelOne.a.b.d" ,"e" )));
1211
+ assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" , new org .bson .Document ("levelOne.a.b.d" , "e" )));
1212
1212
}
1213
1213
1214
1214
@ Test // GH-3775
@@ -1218,7 +1218,7 @@ void mapNestedIntegerFieldCorrectly() {
1218
1218
Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1219
1219
context .getPersistentEntity (EntityWithNestedMap .class ));
1220
1220
1221
- assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" ,new org .bson .Document ("levelOne.0.1.3" ,"4" )));
1221
+ assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" , new org .bson .Document ("levelOne.0.1.3" , "4" )));
1222
1222
}
1223
1223
1224
1224
@ Test // GH-3775
@@ -1228,7 +1228,7 @@ void mapNestedMixedStringIntegerFieldCorrectly() {
1228
1228
Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1229
1229
context .getPersistentEntity (EntityWithNestedMap .class ));
1230
1230
1231
- assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" ,new org .bson .Document ("levelOne.0.1.c" ,"4" )));
1231
+ assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" , new org .bson .Document ("levelOne.0.1.c" , "4" )));
1232
1232
}
1233
1233
1234
1234
@ Test // GH-3775
@@ -1238,7 +1238,7 @@ void mapNestedMixedStringIntegerWithStartNumberFieldCorrectly() {
1238
1238
Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1239
1239
context .getPersistentEntity (EntityWithNestedMap .class ));
1240
1240
1241
- assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" ,new org .bson .Document ("levelOne.0a.1b.3c" ,"4" )));
1241
+ assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" , new org .bson .Document ("levelOne.0a.1b.3c" , "4" )));
1242
1242
}
1243
1243
1244
1244
@ Test // GH-3688
@@ -1262,7 +1262,7 @@ void updateWithDocuRefOnId() {
1262
1262
Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1263
1263
context .getPersistentEntity (WithDocumentReference .class ));
1264
1264
1265
- assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" ,new org .bson .Document ("sample" ,"s1" )));
1265
+ assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" , new org .bson .Document ("sample" , "s1" )));
1266
1266
}
1267
1267
1268
1268
@ Test // GH-3853
@@ -1276,7 +1276,8 @@ void updateListWithDocuRefOnId() {
1276
1276
Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1277
1277
context .getPersistentEntity (WithDocumentReference .class ));
1278
1278
1279
- assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" ,new org .bson .Document ("samples" ,Arrays .asList ("s1" ))));
1279
+ assertThat (mappedUpdate )
1280
+ .isEqualTo (new org .bson .Document ("$set" , new org .bson .Document ("samples" , Arrays .asList ("s1" ))));
1280
1281
}
1281
1282
1282
1283
@ Test // GH-3853
@@ -1291,7 +1292,7 @@ void updateWithDocuRefOnProperty() {
1291
1292
Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1292
1293
context .getPersistentEntity (WithDocumentReference .class ));
1293
1294
1294
- assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" ,new org .bson .Document ("customer" ,"c-name" )));
1295
+ assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" , new org .bson .Document ("customer" , "c-name" )));
1295
1296
}
1296
1297
1297
1298
@ Test // GH-3853
@@ -1306,7 +1307,8 @@ void updateListWithDocuRefOnProperty() {
1306
1307
Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1307
1308
context .getPersistentEntity (WithDocumentReference .class ));
1308
1309
1309
- assertThat (mappedUpdate ).isEqualTo (new org .bson .Document ("$set" ,new org .bson .Document ("customers" , Arrays .asList ("c-name" ))));
1310
+ assertThat (mappedUpdate )
1311
+ .isEqualTo (new org .bson .Document ("$set" , new org .bson .Document ("customers" , Arrays .asList ("c-name" ))));
1310
1312
}
1311
1313
1312
1314
@ Test // GH-3921
@@ -1316,7 +1318,7 @@ void mapNumericKeyInPathHavingComplexMapValyeTypes() {
1316
1318
Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1317
1319
context .getPersistentEntity (TestData .class ));
1318
1320
1319
- assertThat (mappedUpdate ).isEqualTo (new org . bson . Document ( " $set" , new org . bson . Document ( " testInnerData.testMap.1.intValue" , "4" )) );
1321
+ assertThat (mappedUpdate ).isEqualTo ("{ $set: { ' testInnerData.testMap.1.intValue': '4' }}" );
1320
1322
}
1321
1323
1322
1324
@ Test // GH-3921
@@ -1326,7 +1328,7 @@ void mapNumericKeyInPathNotMatchingExistingProperties() {
1326
1328
Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1327
1329
context .getPersistentEntity (TestData .class ));
1328
1330
1329
- assertThat (mappedUpdate ).isEqualTo (new org . bson . Document ( " $set" , new org . bson . Document ( " testInnerData.imaginaryMap.1.noExistingProperty" , "4" )) );
1331
+ assertThat (mappedUpdate ).isEqualTo ("{ $set: { ' testInnerData.imaginaryMap.1.nonExistingProperty': '4' }}" );
1330
1332
}
1331
1333
1332
1334
@ Test // GH-3921
@@ -1336,7 +1338,7 @@ void mapNumericKeyInPathPartiallyMatchingExistingProperties() {
1336
1338
Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1337
1339
context .getPersistentEntity (TestData .class ));
1338
1340
1339
- assertThat (mappedUpdate ).isEqualTo (new org . bson . Document ( " $set" , new org . bson . Document ( " testInnerData.testMap.1.nonExistingProperty.2.someValue" , "4" )) );
1341
+ assertThat (mappedUpdate ).isEqualTo ("{ $set: { ' testInnerData.testMap.1.nonExistingProperty.2.someValue': '4' }}" );
1340
1342
}
1341
1343
1342
1344
static class DomainTypeWrappingConcreteyTypeHavingListOfInterfaceTypeAttributes {
@@ -1575,7 +1577,7 @@ static class EntityWithObjectMap {
1575
1577
Map <Object , NestedDocument > concreteMap ;
1576
1578
}
1577
1579
1578
- static class EntityWithIntKeyedMap {
1580
+ static class EntityWithIntKeyedMap {
1579
1581
Map <Integer , EntityWithObjectMap > intKeyedMap ;
1580
1582
}
1581
1583
@@ -1711,8 +1713,7 @@ static class EntityWithNestedMap {
1711
1713
1712
1714
static class Customer {
1713
1715
1714
- @ Id
1715
- private ObjectId id ;
1716
+ @ Id private ObjectId id ;
1716
1717
private String name ;
1717
1718
}
1718
1719
@@ -1727,23 +1728,18 @@ static class WithDocumentReference {
1727
1728
1728
1729
private String name ;
1729
1730
1730
- @ DocumentReference (lookup = "{ 'name' : ?#{#target} }" )
1731
- private Customer customer ;
1731
+ @ DocumentReference (lookup = "{ 'name' : ?#{#target} }" ) private Customer customer ;
1732
1732
1733
- @ DocumentReference (lookup = "{ 'name' : ?#{#target} }" )
1734
- private List <Customer > customers ;
1733
+ @ DocumentReference (lookup = "{ 'name' : ?#{#target} }" ) private List <Customer > customers ;
1735
1734
1736
- @ DocumentReference
1737
- private Sample sample ;
1735
+ @ DocumentReference private Sample sample ;
1738
1736
1739
- @ DocumentReference
1740
- private List <Sample > samples ;
1737
+ @ DocumentReference private List <Sample > samples ;
1741
1738
}
1742
1739
1743
1740
@ Data
1744
1741
private static class TestData {
1745
- @ Id
1746
- private String id ;
1742
+ @ Id private String id ;
1747
1743
private TestInnerData testInnerData ;
1748
1744
}
1749
1745
0 commit comments