mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-23 12:52:07 +01:00
Even more EncryptionOptions tests
This commit is contained in:
parent
762d9d4803
commit
7696f120e6
1 changed files with 15 additions and 0 deletions
|
@ -39,6 +39,7 @@ import org.junit.jupiter.api.Test;
|
||||||
import org.pgpainless.PGPainless;
|
import org.pgpainless.PGPainless;
|
||||||
import org.pgpainless.algorithm.KeyFlag;
|
import org.pgpainless.algorithm.KeyFlag;
|
||||||
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
|
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
|
||||||
|
import org.pgpainless.exception.KeyValidationException;
|
||||||
import org.pgpainless.key.SubkeyIdentifier;
|
import org.pgpainless.key.SubkeyIdentifier;
|
||||||
import org.pgpainless.key.generation.KeySpec;
|
import org.pgpainless.key.generation.KeySpec;
|
||||||
import org.pgpainless.key.generation.type.KeyType;
|
import org.pgpainless.key.generation.type.KeyType;
|
||||||
|
@ -181,4 +182,18 @@ public class EncryptionOptionsTest {
|
||||||
options.addRecipients(collection);
|
options.addRecipients(collection);
|
||||||
assertEquals(2, options.getEncryptionKeyIdentifiers().size());
|
assertEquals(2, options.getEncryptionKeyIdentifiers().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAddRecipient_withValidUserId() {
|
||||||
|
EncryptionOptions options = new EncryptionOptions();
|
||||||
|
options.addRecipient(publicKeys, "test@pgpainless.org");
|
||||||
|
|
||||||
|
assertEquals(1, options.getEncryptionMethods().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAddRecipient_withInvalidUserId() {
|
||||||
|
EncryptionOptions options = new EncryptionOptions();
|
||||||
|
assertThrows(KeyValidationException.class, () -> options.addRecipient(publicKeys, "invalid@user.id"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue