mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 18:59:39 +02:00
Clean up UserId.toString() behavior
This commit is contained in:
parent
6913aa3d6d
commit
b0c283e143
3 changed files with 26 additions and 27 deletions
|
@ -151,15 +151,13 @@ public class UserIdTest {
|
|||
@Test
|
||||
void testEmailOnlyFormatting() {
|
||||
final UserId userId = UserId.onlyEmail("john.smith@example.com");
|
||||
assertEquals("john.smith@example.com", userId.toString());
|
||||
assertEquals("<john.smith@example.com>", userId.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEmptyNameAndValidEmailFormatting() {
|
||||
final UserId userId = UserId.nameAndEmail("", "john.smith@example.com");
|
||||
assertEquals("john.smith@example.com", userId.toString());
|
||||
assertEquals("john.smith@example.com", userId.asString(false));
|
||||
assertEquals("john.smith@example.com", userId.asString(true));
|
||||
assertEquals("<john.smith@example.com>", userId.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -169,9 +167,7 @@ public class UserIdTest {
|
|||
.withName("")
|
||||
.withEmail("john.smith@example.com")
|
||||
.build();
|
||||
assertEquals(" () <john.smith@example.com>", userId.toString());
|
||||
assertEquals(" () <john.smith@example.com>", userId.asString(false));
|
||||
assertEquals("john.smith@example.com", userId.asString(true));
|
||||
assertEquals("<john.smith@example.com>", userId.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -51,9 +51,9 @@ public class GenerateKeyWithAdditionalUserIdTest {
|
|||
JUtils.assertDateEquals(expiration, PGPainless.inspectKeyRing(publicKeys).getPrimaryKeyExpirationDate());
|
||||
|
||||
Iterator<String> userIds = publicKeys.getPublicKey().getUserIDs();
|
||||
assertEquals("primary@user.id", userIds.next());
|
||||
assertEquals("additional@user.id", userIds.next());
|
||||
assertEquals("additional2@user.id", userIds.next());
|
||||
assertEquals("<primary@user.id>", userIds.next());
|
||||
assertEquals("<additional@user.id>", userIds.next());
|
||||
assertEquals("<additional2@user.id>", userIds.next());
|
||||
assertEquals("trimThis@user.id", userIds.next());
|
||||
assertFalse(userIds.hasNext());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue