1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-22 20:32:05 +01:00

More UserId tests

This commit is contained in:
Paul Schaub 2022-11-30 16:06:01 +01:00
parent 837fbd3635
commit e69c4a8cf7

View file

@ -181,4 +181,35 @@ public class UserIdTest {
final UserId userId2 = UserId.newBuilder().withComment(comment2).withName(name).withEmail(email).build();
assertNotEquals(userId1, userId2);
}
@Test
public void testLength() {
UserId id = UserId.nameAndEmail("Alice", "alice@pgpainless.org");
assertEquals(28, id.length());
}
@Test
public void testSubSequence() {
UserId id = UserId.onlyEmail("alice@pgpainless.org");
assertEquals("alice@pgpainless.org", id.subSequence(1, id.length() - 1));
}
@Test
public void asStringTest() {
UserId id = UserId.newBuilder()
.withName("Alice")
.withComment("Work Email")
.withEmail("alice@pgpainless.org")
.build();
// noinspection deprecation
assertEquals(id.toString(), id.asString());
}
@Test
public void charAtTest() {
UserId id = UserId.onlyEmail("alice@pgpainless.org");
assertEquals('<', id.charAt(0));
assertEquals('>', id.charAt(id.length() - 1));
}
}