MBMailUtil { public static long getParentMessageId(Message message) throws Exception { long parentMessageId = -1; String parentMessageIdString = getParentMessageIdString(message); if (parentMessageIdString != null) { if (_log.isDebugEnabled()) { _log.debug("Parent header " + parentMessageIdString); } parentMessageId = getMessageId(parentMessageIdString); if (_log.isDebugEnabled()) { _log.debug("Parent message id " + parentMessageId); } } return parentMessageId; }  static void collectPartContent(
			Part part, MBMailMessage mbMailMessage); static long getCategoryId(String messageIdString); static long getMessageId(String messageIdString); static int getMessageIdStringOffset(); static long getParentMessageId(Message message); static String getParentMessageIdString(Message message); static String getReplyToAddress(
		long categoryId, long messageId, String mx,
		String defaultMailingListAddress); static String getSubjectForEmail(MBMessage message); static String getSubjectWithoutMessageId(Message message); static boolean hasMailIdHeader(Message message); static final String MESSAGE_POP_PORTLET_PREFIX; }
@Test public void testGetParentMessageIdWithTheInReplyToHeader() throws Exception { Message message = Mockito.mock(Message.class); Mockito.when( message.getHeader("In-Reply-To") ).thenReturn( new String[] {"<mb_message.10640.20646.1425017183884@gmail.com>"} ); Assert.assertEquals(20646, MBMailUtil.getParentMessageId(message)); }
@Test public void testGetParentMessageIdWithTheReferencesHeader() throws Exception { Message message = Mockito.mock(Message.class); Mockito.when( message.getHeader("References") ).thenReturn( new String[] {"<mb_message.10640.20646.1425017183884@gmail.com>"} ); Assert.assertEquals(20646, MBMailUtil.getParentMessageId(message)); }
@Test public void testGetParentMessageWithTheInReplyToHeader() throws Exception { Message message = Mockito.mock(Message.class); Mockito.when( message.getHeader("In-Reply-To") ).thenReturn( new String[] {"<mb_message.10640.20646.1425017183884@gmail.com>"} ); Assert.assertEquals(20646, MBMailUtil.getParentMessageId(message)); }