@@ -145,9 +145,7 @@ private void doEncryptDecryptWithParsedCiphertext(final int byteSize, final int
145145 @ Test
146146 public void encryptDecrypt () {
147147 for (final CryptoAlgorithm cryptoAlg : EnumSet .allOf (CryptoAlgorithm .class )) {
148- final int blockSize = cryptoAlg .getBlockSize ();
149- final int [] frameSizeToTest = { 0 , blockSize , blockSize * 2 , blockSize * 10 ,
150- AwsCrypto .getDefaultFrameSize () };
148+ final int [] frameSizeToTest = TestUtils .getFrameSizesToTest (cryptoAlg );
151149
152150 for (int i = 0 ; i < frameSizeToTest .length ; i ++) {
153151 final int frameSize = frameSizeToTest [i ];
@@ -175,9 +173,7 @@ public void encryptDecryptWithBadSignature() {
175173 if (cryptoAlg .getTrailingSignatureAlgo () == null ) {
176174 continue ;
177175 }
178- final int blockSize = cryptoAlg .getBlockSize ();
179- final int [] frameSizeToTest = { 0 , blockSize , blockSize * 2 , blockSize * 10 ,
180- AwsCrypto .getDefaultFrameSize () };
176+ final int [] frameSizeToTest = TestUtils .getFrameSizesToTest (cryptoAlg );
181177
182178 for (int i = 0 ; i < frameSizeToTest .length ; i ++) {
183179 final int frameSize = frameSizeToTest [i ];
@@ -202,9 +198,7 @@ public void encryptDecryptWithBadSignature() {
202198 @ Test
203199 public void encryptDecryptWithParsedCiphertext () {
204200 for (final CryptoAlgorithm cryptoAlg : EnumSet .allOf (CryptoAlgorithm .class )) {
205- final int blockSize = cryptoAlg .getBlockSize ();
206- final int [] frameSizeToTest = { 0 , blockSize , blockSize * 2 , blockSize * 10 ,
207- AwsCrypto .getDefaultFrameSize () };
201+ final int [] frameSizeToTest = TestUtils .getFrameSizesToTest (cryptoAlg );
208202
209203 for (int i = 0 ; i < frameSizeToTest .length ; i ++) {
210204 final int frameSize = frameSizeToTest [i ];
@@ -336,9 +330,7 @@ private void doEstimateCiphertextSize(final CryptoAlgorithm cryptoAlg, final int
336330 @ Test
337331 public void estimateCiphertextSize () {
338332 for (final CryptoAlgorithm cryptoAlg : EnumSet .allOf (CryptoAlgorithm .class )) {
339- final int blockSize = cryptoAlg .getBlockSize ();
340- final int [] frameSizeToTest = { 0 , blockSize , blockSize * 2 , blockSize * 10 ,
341- AwsCrypto .getDefaultFrameSize () };
333+ final int [] frameSizeToTest = TestUtils .getFrameSizesToTest (cryptoAlg );
342334
343335 for (int i = 0 ; i < frameSizeToTest .length ; i ++) {
344336 final int frameSize = frameSizeToTest [i ];
@@ -664,10 +656,12 @@ public void setValidFrameSize() throws IOException {
664656 assertEquals (setFrameSize , getFrameSize );
665657 }
666658
667- @ Test ( expected = IllegalArgumentException . class )
668- public void unalignedFrameSizesAreRejected () throws IOException {
659+
660+ public void unalignedFrameSizesAreAccepted () throws IOException {
669661 final int frameSize = AwsCrypto .getDefaultCryptoAlgorithm ().getBlockSize () - 1 ;
670662 encryptionClient_ .setEncryptionFrameSize (frameSize );
663+
664+ assertEquals (frameSize , encryptionClient_ .getEncryptionFrameSize ());
671665 }
672666
673667 @ Test (expected = IllegalArgumentException .class )
0 commit comments