@@ -39,6 +39,7 @@ public void TestPutItemEncryptsAccordingToAttributeActions() {
39
39
PutItemRequest oldRequest = PutItemRequest .builder ()
40
40
.tableName (TEST_TABLE_NAME )
41
41
.item (item )
42
+ .conditionExpression (TEST_ATTR2_NAME + " < :a" )
42
43
.build ();
43
44
44
45
Context .ModifyRequest context = InterceptorContext .builder ()
@@ -100,10 +101,10 @@ public void TestInterceptorBuilderAcceptsLegacyEncryptor() {
100
101
}
101
102
102
103
@ Test
103
- public void TestPutItemGetItemWithConditionExpression () {
104
+ public void TestPutItemGetItemWithConditionExpressionBad () {
104
105
PutItemRequest oldRequest = PutItemRequest .builder ()
105
106
.tableName (TEST_TABLE_NAME )
106
- .conditionExpression ("foo " )
107
+ .conditionExpression (TEST_ATTR_NAME + " < :a " )
107
108
.build ();
108
109
109
110
Context .ModifyRequest context = InterceptorContext .builder ()
@@ -117,7 +118,7 @@ public void TestPutItemGetItemWithConditionExpression() {
117
118
Exception exception = assertThrows (DynamoDbEncryptionException .class , () -> {
118
119
interceptor .modifyRequest (context , attributes );
119
120
});
120
- assertTrue (exception .getMessage ().contains ("Condition Expressions forbidden on encrypted tables " ));
121
+ assertTrue (exception .getMessage ().contains ("Condition Expressions forbidden on encrypted attributes : attr1 " ));
121
122
}
122
123
123
124
@ Test
@@ -191,7 +192,7 @@ public void TestTransactWriteItemsWithConditionCheck() {
191
192
.build ())
192
193
.conditionCheck (ConditionCheck .builder ()
193
194
.tableName (TEST_TABLE_NAME )
194
- .conditionExpression ("foo " )
195
+ .conditionExpression (TEST_ATTR_NAME + " < :a " )
195
196
.build ())
196
197
.build ())
197
198
.build ();
@@ -207,7 +208,7 @@ public void TestTransactWriteItemsWithConditionCheck() {
207
208
Exception exception = assertThrows (DynamoDbEncryptionException .class , () -> {
208
209
interceptor .modifyRequest (context , attributes );
209
210
});
210
- assertTrue (exception .getMessage ().contains ("Condition Expressions forbidden on encrypted tables " ));
211
+ assertTrue (exception .getMessage ().contains ("Condition Expressions forbidden on encrypted attributes : attr1 " ));
211
212
}
212
213
213
214
@ Test
@@ -217,7 +218,7 @@ public void TestTransactWriteItemsWithPutConditionExpression() {
217
218
TransactWriteItem .builder ()
218
219
.put (Put .builder ()
219
220
.tableName (TEST_TABLE_NAME )
220
- .conditionExpression ("foo " )
221
+ .conditionExpression (TEST_ATTR_NAME + " < :a " )
221
222
.build ())
222
223
.build ())
223
224
.build ();
@@ -233,7 +234,7 @@ public void TestTransactWriteItemsWithPutConditionExpression() {
233
234
Exception exception = assertThrows (DynamoDbEncryptionException .class , () -> {
234
235
interceptor .modifyRequest (context , attributes );
235
236
});
236
- assertTrue (exception .getMessage ().contains ("Condition Expressions forbidden on encrypted tables " ));
237
+ assertTrue (exception .getMessage ().contains ("Condition Expressions forbidden on encrypted attributes : attr1 " ));
237
238
}
238
239
239
240
@ Test
@@ -243,7 +244,7 @@ public void TestTransactWriteItemsWithDeleteConditionExpression() {
243
244
TransactWriteItem .builder ()
244
245
.delete (Delete .builder ()
245
246
.tableName (TEST_TABLE_NAME )
246
- .conditionExpression ("foo " )
247
+ .conditionExpression (TEST_ATTR_NAME + " < :a " )
247
248
.build ())
248
249
.build ())
249
250
.build ();
@@ -259,7 +260,7 @@ public void TestTransactWriteItemsWithDeleteConditionExpression() {
259
260
Exception exception = assertThrows (DynamoDbEncryptionException .class , () -> {
260
261
interceptor .modifyRequest (context , attributes );
261
262
});
262
- assertTrue (exception .getMessage ().contains ("Condition Expressions forbidden on encrypted tables " ));
263
+ assertTrue (exception .getMessage ().contains ("Condition Expressions forbidden on encrypted attributes : attr1 " ));
263
264
}
264
265
265
266
@ Test
@@ -318,7 +319,7 @@ public void TestTransactWriteItemsWithUpdateOnEncryptedTableBad() {
318
319
public void TestDeleteItemWithConditionExpression () {
319
320
DeleteItemRequest oldRequest = DeleteItemRequest .builder ()
320
321
.tableName (TEST_TABLE_NAME )
321
- .conditionExpression ("foo " )
322
+ .conditionExpression (TEST_ATTR_NAME + " < :a " )
322
323
.build ();
323
324
324
325
Context .ModifyRequest context = InterceptorContext .builder ()
@@ -332,7 +333,7 @@ public void TestDeleteItemWithConditionExpression() {
332
333
Exception exception = assertThrows (DynamoDbEncryptionException .class , () -> {
333
334
interceptor .modifyRequest (context , attributes );
334
335
});
335
- assertTrue (exception .getMessage ().contains ("Condition Expressions forbidden on encrypted tables " ));
336
+ assertTrue (exception .getMessage ().contains ("Condition Expressions forbidden on encrypted attributes : attr1 " ));
336
337
}
337
338
338
339
@ Test
0 commit comments