Skip to content

Commit b5fce22

Browse files
authored
Merge pull request #73 from johnwalker/testwhitespacecleanup
Whitespace and import cleanup on tests
2 parents 562414a + 843440c commit b5fce22

File tree

48 files changed

+1637
-1637
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1637
-1637
lines changed

src/test/java/com/amazonaws/services/dynamodbv2/datamodeling/AttributeEncryptorTest.java

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,6 @@
1414
*/
1515
package com.amazonaws.services.dynamodbv2.datamodeling;
1616

17-
import static org.junit.Assert.assertEquals;
18-
import static org.junit.Assert.assertNotNull;
19-
import static org.junit.Assert.assertNull;
20-
import static org.junit.Assert.assertThat;
21-
import static org.junit.Assert.assertTrue;
22-
23-
import java.nio.ByteBuffer;
24-
import java.security.KeyPair;
25-
import java.security.KeyPairGenerator;
26-
import java.security.NoSuchAlgorithmException;
27-
import java.util.Collection;
28-
import java.util.Collections;
29-
import java.util.HashMap;
30-
import java.util.HashSet;
31-
import java.util.Map;
32-
import java.util.Set;
33-
34-
import javax.crypto.KeyGenerator;
35-
import javax.crypto.SecretKey;
36-
37-
import org.junit.Assert;
38-
import org.junit.Before;
39-
import org.junit.BeforeClass;
40-
import org.junit.Test;
41-
4217
import com.amazonaws.services.dynamodbv2.datamodeling.AttributeTransformer.Parameters;
4318
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.providers.EncryptionMaterialsProvider;
4419
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.providers.SymmetricStaticProvider;
@@ -58,6 +33,29 @@
5833
import com.amazonaws.services.dynamodbv2.testing.types.UntouchedWithNewAttribute;
5934
import com.amazonaws.services.dynamodbv2.testing.types.UntouchedWithUnknownAttributeAnnotation;
6035
import com.amazonaws.services.dynamodbv2.testing.types.UntouchedWithUnknownAttributeAnnotationWithNewAttribute;
36+
import org.junit.Assert;
37+
import org.junit.Before;
38+
import org.junit.BeforeClass;
39+
import org.junit.Test;
40+
41+
import javax.crypto.KeyGenerator;
42+
import javax.crypto.SecretKey;
43+
import java.nio.ByteBuffer;
44+
import java.security.KeyPair;
45+
import java.security.KeyPairGenerator;
46+
import java.security.NoSuchAlgorithmException;
47+
import java.util.Collection;
48+
import java.util.Collections;
49+
import java.util.HashMap;
50+
import java.util.HashSet;
51+
import java.util.Map;
52+
import java.util.Set;
53+
54+
import static org.junit.Assert.assertEquals;
55+
import static org.junit.Assert.assertNotNull;
56+
import static org.junit.Assert.assertNull;
57+
import static org.junit.Assert.assertThat;
58+
import static org.junit.Assert.assertTrue;
6159

6260
public class AttributeEncryptorTest {
6361
private static final String RANGE_KEY = "rangeKey";
@@ -84,14 +82,14 @@ public static void setUpClass() throws Exception {
8482
@Before
8583
public void setUp() throws Exception {
8684
prov = new SymmetricStaticProvider(encryptionKey, macKey,
87-
Collections.<String, String> emptyMap());
85+
Collections.<String, String>emptyMap());
8886
encryptor = new AttributeEncryptor(prov);
8987

9088
attribs = new HashMap<String, AttributeValue>();
9189
attribs.put("intValue", new AttributeValue().withN("123"));
9290
attribs.put("stringValue", new AttributeValue().withS("Hello world!"));
9391
attribs.put("byteArrayValue",
94-
new AttributeValue().withB(ByteBuffer.wrap(new byte[] { 0, 1, 2, 3, 4, 5 })));
92+
new AttributeValue().withB(ByteBuffer.wrap(new byte[]{0, 1, 2, 3, 4, 5})));
9593
attribs.put("stringSet", new AttributeValue().withSS("Goodbye", "Cruel", "World", "?"));
9694
attribs.put("intSet", new AttributeValue().withNS("1", "200", "10", "15", "0"));
9795
attribs.put(HASH_KEY, new AttributeValue().withN("5"));
@@ -132,7 +130,7 @@ public void fullEncryption() {
132130
@Test(expected = DynamoDBMappingException.class)
133131
public void rejectsPartialUpdate() {
134132
Parameters<BaseClass> params = FakeParameters.getInstance(BaseClass.class, attribs, null,
135-
TABLE_NAME, HASH_KEY, RANGE_KEY, true);
133+
TABLE_NAME, HASH_KEY, RANGE_KEY, true);
136134
encryptor.transform(params);
137135
}
138136

@@ -187,7 +185,7 @@ public void signedOnly() {
187185

188186
@Test
189187
public void signedOnlyNullCryptoKey() {
190-
prov = new SymmetricStaticProvider(null, macKey, Collections.<String, String> emptyMap());
188+
prov = new SymmetricStaticProvider(null, macKey, Collections.<String, String>emptyMap());
191189
encryptor = new AttributeEncryptor(prov);
192190
Parameters<SignOnly> params = FakeParameters.getInstance(SignOnly.class, attribs, null,
193191
TABLE_NAME, HASH_KEY, RANGE_KEY);
@@ -235,7 +233,7 @@ public void RsaSignedOnly() throws NoSuchAlgorithmException {
235233
rsaGen.initialize(2048, Utils.getRng());
236234
KeyPair sigPair = rsaGen.generateKeyPair();
237235
encryptor = new AttributeEncryptor(new SymmetricStaticProvider(encryptionKey, sigPair,
238-
Collections.<String, String> emptyMap()));
236+
Collections.<String, String>emptyMap()));
239237

240238
Parameters<SignOnly> params = FakeParameters.getInstance(SignOnly.class, attribs, null,
241239
TABLE_NAME, HASH_KEY, RANGE_KEY);
@@ -261,7 +259,7 @@ public void RsaSignedOnlyBadSignature() throws NoSuchAlgorithmException {
261259
rsaGen.initialize(2048, Utils.getRng());
262260
KeyPair sigPair = rsaGen.generateKeyPair();
263261
encryptor = new AttributeEncryptor(new SymmetricStaticProvider(encryptionKey, sigPair,
264-
Collections.<String, String> emptyMap()));
262+
Collections.<String, String>emptyMap()));
265263
Parameters<SignOnly> params = FakeParameters.getInstance(SignOnly.class, attribs, null,
266264
TABLE_NAME, HASH_KEY, RANGE_KEY);
267265
Map<String, AttributeValue> encryptedAttributes = encryptor.transform(params);
@@ -321,7 +319,7 @@ public void mixedBadSignature() {
321319
@Test(expected = DynamoDBMappingException.class)
322320
public void tableNameRespected() {
323321
Parameters<BaseClass> params = FakeParameters.getInstance(BaseClass.class, attribs, null, "firstTable",
324-
HASH_KEY, RANGE_KEY);
322+
HASH_KEY, RANGE_KEY);
325323
Map<String, AttributeValue> encryptedAttributes = encryptor.transform(params);
326324
assertThat(encryptedAttributes, AttrMatcher.invert(attribs));
327325
params = FakeParameters.getInstance(BaseClass.class, encryptedAttributes, null, "secondTable",
@@ -332,7 +330,7 @@ public void tableNameRespected() {
332330
@Test
333331
public void tableNameOverridden() {
334332
Parameters<TableOverride> params = FakeParameters.getInstance(TableOverride.class, attribs, null, "firstTable",
335-
HASH_KEY, RANGE_KEY);
333+
HASH_KEY, RANGE_KEY);
336334
Map<String, AttributeValue> encryptedAttributes = encryptor.transform(params);
337335
assertThat(encryptedAttributes, AttrMatcher.invert(attribs));
338336
params = FakeParameters.getInstance(TableOverride.class, encryptedAttributes, null, "secondTable",
@@ -341,7 +339,7 @@ public void tableNameOverridden() {
341339
Map<String, AttributeValue> decryptedAttributes = encryptor.untransform(params);
342340
assertThat(decryptedAttributes, AttrMatcher.match(attribs));
343341
}
344-
342+
345343
@Test(expected = DynamoDBMappingException.class)
346344
public void testUnknownAttributeFails() {
347345
Map<String, AttributeValue> attributes = new HashMap<>(attribs);
@@ -403,7 +401,7 @@ public void testSignOnlyWithUnknownAttributeAnnotation() {
403401
Map<String, AttributeValue> decryptedAttributes = encryptor.untransform(params);
404402
assertThat(decryptedAttributes, AttrMatcher.match(attributes));
405403
}
406-
404+
407405
@Test(expected = DynamoDBMappingException.class)
408406
public void testSignOnlyWithUnknownAttributeAnnotationBadSignature() {
409407
Map<String, AttributeValue> attributes = new HashMap<>(attribs);
@@ -436,7 +434,7 @@ public void testEncryptWithUnknownAttributeAnnotation() {
436434
Map<String, AttributeValue> decryptedAttributes = encryptor.untransform(params);
437435
assertThat(decryptedAttributes, AttrMatcher.match(attributes));
438436
}
439-
437+
440438
@Test(expected = DynamoDBMappingException.class)
441439
public void testEncryptWithUnknownAttributeAnnotationBadSignature() {
442440
Map<String, AttributeValue> attributes = new HashMap<>(attribs);

0 commit comments

Comments
 (0)