mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-09-28 18:49:56 +02:00
Add test for SubkeyIdentifier.isPrimaryKey()
This commit is contained in:
parent
b8e6cd4f1c
commit
8193d20900
|
@ -5,8 +5,10 @@
|
||||||
package org.pgpainless.key;
|
package org.pgpainless.key;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
@ -102,6 +104,15 @@ public class SubkeyIdentifierTest {
|
||||||
assertNotEquals(id1, null);
|
assertNotEquals(id1, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsPrimaryKey() {
|
||||||
|
SubkeyIdentifier primaryKey = new SubkeyIdentifier(PRIMARY_FP);
|
||||||
|
assertTrue(primaryKey.isPrimaryKey());
|
||||||
|
|
||||||
|
SubkeyIdentifier subKey = new SubkeyIdentifier(PRIMARY_FP, SUBKEY_FP);
|
||||||
|
assertFalse(subKey.isPrimaryKey());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void nonExistentSubkeyThrowsNoSuchElementException() {
|
public void nonExistentSubkeyThrowsNoSuchElementException() {
|
||||||
assertThrows(NoSuchElementException.class, () -> new SubkeyIdentifier(CERT, 123));
|
assertThrows(NoSuchElementException.class, () -> new SubkeyIdentifier(CERT, 123));
|
||||||
|
|
Loading…
Reference in a new issue