4545import software .amazon .awssdk .services .kms .model .GenerateDataKeyRequest ;
4646import software .amazon .awssdk .services .kms .model .GenerateDataKeyResponse ;
4747
48- public class DirectKmsMaterialsProviderTest {
48+ public class DirectKmsMaterialProviderTest {
4949
5050 private FakeKMS kms ;
5151 private String keyId ;
@@ -64,10 +64,7 @@ public void setUp() {
6464
6565 @ Test
6666 public void simple () {
67- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
68- kms ,
69- keyId
70- );
67+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (kms , keyId );
7168
7269 EncryptionMaterials eMat = prov .getEncryptionMaterials (ctx );
7370 SecretKey encryptionKey = eMat .getEncryptionKey ();
@@ -96,10 +93,7 @@ public void simple() {
9693
9794 @ Test
9895 public void simpleWithKmsEc () {
99- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
100- kms ,
101- keyId
102- );
96+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (kms , keyId );
10397
10498 Map <String , AttributeValue > attrVals = new HashMap <>();
10599 attrVals .put ("hk" , AttributeValue .builder ().s ("HashKeyValue" ).build ());
@@ -136,10 +130,7 @@ public void simpleWithKmsEc() {
136130
137131 @ Test
138132 public void simpleWithKmsEc2 () throws GeneralSecurityException {
139- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
140- kms ,
141- keyId
142- );
133+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (kms , keyId );
143134
144135 Map <String , AttributeValue > attrVals = new HashMap <>();
145136 attrVals .put ("hk" , AttributeValue .builder ().n ("10" ).build ());
@@ -176,10 +167,7 @@ public void simpleWithKmsEc2() throws GeneralSecurityException {
176167
177168 @ Test
178169 public void simpleWithKmsEc3 () throws GeneralSecurityException {
179- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
180- kms ,
181- keyId
182- );
170+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (kms , keyId );
183171
184172 Map <String , AttributeValue > attrVals = new HashMap <>();
185173 attrVals .put (
@@ -243,10 +231,7 @@ public void simpleWithKmsEc3() throws GeneralSecurityException {
243231
244232 @ Test
245233 public void randomEnvelopeKeys () throws GeneralSecurityException {
246- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
247- kms ,
248- keyId
249- );
234+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (kms , keyId );
250235
251236 EncryptionMaterials eMat = prov .getEncryptionMaterials (ctx );
252237 SecretKey encryptionKey = eMat .getEncryptionKey ();
@@ -264,10 +249,7 @@ public void randomEnvelopeKeys() throws GeneralSecurityException {
264249 @ Test
265250 public void testRefresh () {
266251 // This does nothing, make sure we don't throw and exception.
267- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
268- kms ,
269- keyId
270- );
252+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (kms , keyId );
271253 prov .refresh ();
272254 }
273255
@@ -276,7 +258,7 @@ public void explicitContentKeyAlgorithm() throws GeneralSecurityException {
276258 Map <String , String > desc = new HashMap <>();
277259 desc .put (WrappedRawMaterials .CONTENT_KEY_ALGORITHM , "AES" );
278260
279- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
261+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (
280262 kms ,
281263 keyId ,
282264 desc
@@ -301,7 +283,7 @@ public void explicitContentKeyLength128() throws GeneralSecurityException {
301283 Map <String , String > desc = new HashMap <>();
302284 desc .put (WrappedRawMaterials .CONTENT_KEY_ALGORITHM , "AES/128" );
303285
304- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
286+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (
305287 kms ,
306288 keyId ,
307289 desc
@@ -328,7 +310,7 @@ public void explicitContentKeyLength256() throws GeneralSecurityException {
328310 Map <String , String > desc = new HashMap <>();
329311 desc .put (WrappedRawMaterials .CONTENT_KEY_ALGORITHM , "AES/256" );
330312
331- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
313+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (
332314 kms ,
333315 keyId ,
334316 desc
@@ -398,7 +380,7 @@ public void extendedWithDerivedEncryptionKeyId() {
398380
399381 @ Test (expectedExceptions = SdkException .class )
400382 public void encryptionKeyIdMismatch () throws SdkException {
401- DirectKmsMaterialsProvider directProvider = new DirectKmsMaterialsProvider (
383+ DirectKmsMaterialProvider directProvider = new DirectKmsMaterialProvider (
402384 kms ,
403385 keyId
404386 );
@@ -469,12 +451,12 @@ public GenerateDataKeyResponse generateDataKey(GenerateDataKeyRequest r) {
469451 }
470452 };
471453 assertFalse (gdkCalled .get ());
472- new DirectKmsMaterialsProvider (kmsSpy , keyId ).getEncryptionMaterials (ctx );
454+ new DirectKmsMaterialProvider (kmsSpy , keyId ).getEncryptionMaterials (ctx );
473455 assertTrue (gdkCalled .get ());
474456 }
475457
476458 private static class ExtendedKmsMaterialsProvider
477- extends DirectKmsMaterialsProvider {
459+ extends DirectKmsMaterialProvider {
478460
479461 private final String encryptionKeyIdAttributeName ;
480462
@@ -553,15 +535,12 @@ private static EncryptionContext ctx(EncryptionMaterials mat) {
553535
554536 @ Test (expectedExceptions = NullPointerException .class )
555537 public void constructorNullKmsClient () {
556- new DirectKmsMaterialsProvider (null , keyId );
538+ new DirectKmsMaterialProvider (null , keyId );
557539 }
558540
559541 @ Test (expectedExceptions = UnsupportedOperationException .class )
560542 public void unsupportedHashKeyType () {
561- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
562- kms ,
563- keyId
564- );
543+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (kms , keyId );
565544 Map <String , AttributeValue > attrVals = new HashMap <>();
566545 attrVals .put ("hk" , AttributeValue .builder ().bool (true ).build ());
567546 EncryptionContext boolCtx = new EncryptionContext .Builder ()
@@ -573,10 +552,7 @@ public void unsupportedHashKeyType() {
573552
574553 @ Test (expectedExceptions = UnsupportedOperationException .class )
575554 public void unsupportedRangeKeyType () {
576- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
577- kms ,
578- keyId
579- );
555+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (kms , keyId );
580556 Map <String , AttributeValue > attrVals = new HashMap <>();
581557 attrVals .put ("hk" , AttributeValue .builder ().s ("HashKeyValue" ).build ());
582558 attrVals .put ("rk" , AttributeValue .builder ().bool (true ).build ());
@@ -590,10 +566,7 @@ public void unsupportedRangeKeyType() {
590566
591567 @ Test (expectedExceptions = NullPointerException .class )
592568 public void hashKeyMissingFromAttributeValues () {
593- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
594- kms ,
595- keyId
596- );
569+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (kms , keyId );
597570 EncryptionContext missingCtx = new EncryptionContext .Builder ()
598571 .hashKeyName ("hk" )
599572 .attributeValues (Collections .emptyMap ())
@@ -603,10 +576,7 @@ public void hashKeyMissingFromAttributeValues() {
603576
604577 @ Test (expectedExceptions = NullPointerException .class )
605578 public void rangeKeyMissingFromAttributeValues () {
606- DirectKmsMaterialsProvider prov = new DirectKmsMaterialsProvider (
607- kms ,
608- keyId
609- );
579+ DirectKmsMaterialProvider prov = new DirectKmsMaterialProvider (kms , keyId );
610580 Map <String , AttributeValue > attrVals = new HashMap <>();
611581 attrVals .put ("hk" , AttributeValue .builder ().s ("HashKeyValue" ).build ());
612582 EncryptionContext missingCtx = new EncryptionContext .Builder ()
0 commit comments