Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit 1920323

Browse files
authored
Removed obsolete testReadingTruncatedDataFile (#565)
This test does not throw the `IllegalBlockSizeException` on newer versions of Android, instead the decrypted content is incomplete. There doesn't seem to be any value in testing this underlying OS behaviour.
1 parent a7f4676 commit 1920323

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

cloudant-sync-datastore-core/src/test/java/com/cloudant/sync/datastore/encryption/EncryptedAttachmentInputStreamTest.java

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2015 IBM Corp. All rights reserved.
2+
* Copyright © 2015, 2018 IBM Corp. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
55
* except in compliance with the License. You may obtain a copy of the License at
@@ -15,13 +15,12 @@
1515
package com.cloudant.sync.datastore.encryption;
1616

1717
import com.cloudant.sync.internal.documentstore.encryption.EncryptedAttachmentInputStream;
18-
import com.cloudant.sync.matcher.CauseMatcher;
1918
import com.cloudant.sync.util.TestUtils;
2019

2120
import org.apache.commons.io.IOUtils;
21+
import org.junit.Assert;
2222
import org.junit.Rule;
2323
import org.junit.Test;
24-
import org.junit.Assert;
2524
import org.junit.rules.ExpectedException;
2625

2726
import java.io.File;
@@ -30,8 +29,6 @@
3029
import java.io.InputStream;
3130
import java.security.InvalidKeyException;
3231

33-
import javax.crypto.IllegalBlockSizeException;
34-
3532
/**
3633
* Test encrypting an attachment to check correct on disk format is read.
3734
*/
@@ -86,25 +83,6 @@ public void testReadingTruncatedIVFile() throws IOException, InvalidKeyException
8683
new FileInputStream(encryptedAttachmentBlob), EncryptionTestConstants.key16Byte);
8784
}
8885

89-
/**
90-
* Test when we read file shorter than block multiple that an IOException escapes.
91-
*/
92-
@Test
93-
public void testReadingTruncatedDataFile() throws IOException, InvalidKeyException {
94-
exception.expect(IOException.class);
95-
exception.expectCause(new CauseMatcher(IllegalBlockSizeException.class));
96-
97-
File encryptedAttachmentBlob = TestUtils.loadFixture(
98-
"fixture/EncryptedAttachmentTest_truncatedData");
99-
InputStream encryptedInputStream = new EncryptedAttachmentInputStream(
100-
new FileInputStream(encryptedAttachmentBlob), EncryptionTestConstants.key16Byte);
101-
102-
//noinspection StatementWithEmptyBody
103-
while (encryptedInputStream.read(new byte[1024]) != -1) {
104-
// just read the data
105-
}
106-
}
107-
10886
@Test(expected=InvalidKeyException.class)
10987
public void Test31ByteKey() throws IOException, InvalidKeyException {
11088
new EncryptedAttachmentInputStream(null, EncryptionTestConstants.keyLength31);
-259 KB
Binary file not shown.

0 commit comments

Comments
 (0)