diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyWithAdditionalUserIdTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyWithAdditionalUserIdTest.java index 4d3f4a90..97931065 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyWithAdditionalUserIdTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyWithAdditionalUserIdTest.java @@ -1,17 +1,19 @@ package org.pgpainless.key.generation; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.security.InvalidAlgorithmParameterException; import java.security.NoSuchAlgorithmException; +import java.util.Iterator; import org.bouncycastle.bcpg.ArmoredOutputStream; import org.bouncycastle.openpgp.PGPException; import org.junit.Test; import org.pgpainless.PGPainless; import org.pgpainless.key.collection.PGPKeyRing; -import org.pgpainless.key.generation.type.KeyType; import org.pgpainless.key.generation.type.RSA_SIGN; import org.pgpainless.key.generation.type.length.RsaLength; @@ -28,11 +30,17 @@ public class GenerateKeyWithAdditionalUserIdTest { .withoutPassphrase() .build(); + Iterator userIds = keyRing.getPublicKeys().getPublicKey().getUserIDs(); + assertEquals("primary@user.id", userIds.next()); + assertEquals("additional@user.id", userIds.next()); + assertFalse(userIds.hasNext()); + ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); ArmoredOutputStream armor = new ArmoredOutputStream(byteOut); keyRing.getSecretKeys().encode(armor); armor.close(); + // echo this | gpg --list-packets System.out.println(byteOut.toString("UTF-8")); } }