mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-30 00:02:06 +01:00
Improve CachingBcPublicKeyDataDecryptorFactoryTest
This commit is contained in:
parent
be7349f0b5
commit
c72b3a4b8e
1 changed files with 7 additions and 0 deletions
|
@ -25,6 +25,8 @@ import org.pgpainless.key.info.KeyRingInfo;
|
||||||
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
||||||
import org.pgpainless.key.protection.UnlockSecretKey;
|
import org.pgpainless.key.protection.UnlockSecretKey;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
public class CachingBcPublicKeyDataDecryptorFactoryTest {
|
public class CachingBcPublicKeyDataDecryptorFactoryTest {
|
||||||
|
|
||||||
private static final String KEY = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n" +
|
private static final String KEY = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n" +
|
||||||
|
@ -83,7 +85,9 @@ public class CachingBcPublicKeyDataDecryptorFactoryTest {
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
Streams.pipeAll(decryptionStream, out);
|
Streams.pipeAll(decryptionStream, out);
|
||||||
decryptionStream.close();
|
decryptionStream.close();
|
||||||
|
assertEquals("Hello, World!\n", out.toString());
|
||||||
|
|
||||||
|
ciphertextIn = new ByteArrayInputStream(MSG.getBytes());
|
||||||
decryptionStream = PGPainless.decryptAndOrVerify()
|
decryptionStream = PGPainless.decryptAndOrVerify()
|
||||||
.onInputStream(ciphertextIn)
|
.onInputStream(ciphertextIn)
|
||||||
.withOptions(ConsumerOptions.get()
|
.withOptions(ConsumerOptions.get()
|
||||||
|
@ -91,5 +95,8 @@ public class CachingBcPublicKeyDataDecryptorFactoryTest {
|
||||||
out = new ByteArrayOutputStream();
|
out = new ByteArrayOutputStream();
|
||||||
Streams.pipeAll(decryptionStream, out);
|
Streams.pipeAll(decryptionStream, out);
|
||||||
decryptionStream.close();
|
decryptionStream.close();
|
||||||
|
assertEquals("Hello, World!\n", out.toString());
|
||||||
|
|
||||||
|
cachingFactory.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue