1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-14 12:49:39 +02:00

SubkeyIdentifier: Throw NoSuchElementException for non-existent subkey

This commit is contained in:
Paul Schaub 2021-08-01 17:23:17 +02:00
parent 1327e08ac3
commit e4fdc3bc1e
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 15 additions and 1 deletions

View file

@ -17,8 +17,10 @@ package org.pgpainless.key;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException;
import java.util.NoSuchElementException;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.junit.jupiter.api.BeforeAll;
@ -110,4 +112,9 @@ public class SubkeyIdentifierTest {
assertNotEquals(id1, PRIMARY_FP);
assertNotEquals(id1, null);
}
@Test
public void nonExistentSubkeyThrowsNoSuchElementException() {
assertThrows(NoSuchElementException.class, () -> new SubkeyIdentifier(CERT, 123));
}
}