Skip to content

Commit ba15b53

Browse files
committed
Polishing.
Fix test. See #4988 Original pull request: #4992 # Conflicts: # spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CollectionOptions.java # spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/QueryCharacteristics.java
1 parent 96c2e71 commit ba15b53

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/encryption/MongoQueryableEncryptionCollectionCreationTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public void createsCollectionWithEncryptedFieldsCorrectly(CollectionOptions coll
108108
.containsEntry("queries", List.of(Document.parse(
109109
"{'queryType': 'range', 'contention': { '$numberLong' : '0' }, 'min': { '$numberLong' : '-1' }, 'max': { '$numberLong' : '1' }}")));
110110

111-
assertThat(fields.get(2)).containsEntry("path", "encryptedDouble") //
111+
assertThat(fields.get(3)).containsEntry("path", "encryptedDouble") //
112112
.containsEntry("bsonType", "double") //
113113
.containsEntry("queries", List.of(Document.parse(
114114
"{'queryType': 'range', 'contention': { '$numberLong' : '1' }, 'min': { '$numberDouble' : '-1.123' }, 'max': { '$numberDouble' : '1.123' }, 'precision': { '$numberInt' : '5'}}")));
@@ -119,13 +119,14 @@ private static Stream<Arguments> collectionOptions() {
119119
BsonBinary key1 = new BsonBinary(UUID.randomUUID(), UuidRepresentation.STANDARD);
120120
BsonBinary key2 = new BsonBinary(UUID.randomUUID(), UuidRepresentation.STANDARD);
121121
BsonBinary key3 = new BsonBinary(UUID.randomUUID(), UuidRepresentation.STANDARD);
122+
BsonBinary key4 = new BsonBinary(UUID.randomUUID(), UuidRepresentation.STANDARD);
122123

123124
CollectionOptions manualOptions = CollectionOptions.encryptedCollection(options -> options //
124125
.encrypted(int32("encrypted-but-not-queryable"), key1) //
125126
.queryable(encrypted(int32("encryptedInt")).keyId(key2), range().min(5).max(100).contention(1)) //
126127
.queryable(encrypted(JsonSchemaProperty.int64("nested.encryptedLong")).keyId(key3),
127128
range().min(-1L).max(1L).contention(0)) //
128-
.queryable(encrypted(JsonSchemaProperty.float64("encryptedDouble")).keys(key3),
129+
.queryable(encrypted(JsonSchemaProperty.float64("encryptedDouble")).keys(key4),
129130
range().min(-1.123D).max(1.123D).precision(5).contention(1)));
130131

131132
CollectionOptions schemaOptions = CollectionOptions.encryptedCollection(MongoJsonSchema.builder() //
@@ -134,7 +135,7 @@ private static Stream<Arguments> collectionOptions() {
134135
queryable(encrypted(int32("encryptedInt")).keyId(key2), List.of(range().min(5).max(100).contention(1))))
135136
.property(queryable(encrypted(int64("nested.encryptedLong")).keyId(key3),
136137
List.of(range().min(-1L).max(1L).contention(0))))
137-
.property(queryable(encrypted(float64("encryptedDouble")).keyId(key3),
138+
.property(queryable(encrypted(float64("encryptedDouble")).keyId(key4),
138139
List.of(range().min(-1.123D).max(1.123D).precision(5).contention(1))))
139140
.build());
140141

0 commit comments

Comments
 (0)