### Question:
KeyRing { public static UserId splitUserId(final String userId) { if (!TextUtils.isEmpty(userId)) { final Matcher matcher = USER_ID_PATTERN.matcher(userId); if (matcher.matches()) { return new UserId(matcher.group(1), matcher.group(3), matcher.group(2)); } } return new UserId(null, null, null); }  abstract long getMasterKeyId(); abstract String getPrimaryUserId(); abstract String getPrimaryUserIdWithFallback(); UserId getSplitPrimaryUserIdWithFallback(); abstract boolean isRevoked(); abstract boolean canCertify(); abstract long getEncryptId(); abstract boolean hasEncrypt(); abstract int getVerified(); static UserId splitUserId(final String userId); static String createUserId(UserId userId);  }### Answer:
@Test public void splitCompleteUserIdShouldReturnAll3Components() throws Exception { KeyRing.UserId info = KeyRing.splitUserId("Max Mustermann (this is a comment) <max@example.com>"); Assert.assertEquals("Max Mustermann", info.name); Assert.assertEquals("this is a comment", info.comment); Assert.assertEquals("max@example.com", info.email); }
@Test public void splitUserIdWithAllButCommentShouldReturnNameAndEmail() throws Exception { KeyRing.UserId info = KeyRing.splitUserId("Max Mustermann <max@example.com>"); Assert.assertEquals("Max Mustermann", info.name); Assert.assertNull(info.comment); Assert.assertEquals("max@example.com", info.email); }
@Test public void splitUserIdWithAllButEmailShouldReturnNameAndComment() throws Exception { KeyRing.UserId info = KeyRing.splitUserId("Max Mustermann (this is a comment)"); Assert.assertEquals(info.name, "Max Mustermann"); Assert.assertEquals(info.comment, "this is a comment"); Assert.assertNull(info.email); }