MessageIdUtils { public static boolean isAllowed(final String messageId) { if (Utils.isNullOrEmpty(messageId)) return false; else return messageId.matches("[" + VALID_CHARS + "]*"); }  static String createMessageId(); static String createContentId(final String msgId); static boolean isAllowed(final String messageId); static boolean isCorrectFormat(final String messageId); static String stripBrackets(final String messageId);  }
@Test public void testIsAllowed() { assertTrue(MessageIdUtils.isAllowed("`a#very$special%id!@some-where+{%&'*/}?^~|")); assertFalse(MessageIdUtils.isAllowed("")); assertFalse(MessageIdUtils.isAllowed("just a test@holodeck-b2b.org")); assertFalse(MessageIdUtils.isAllowed("just[8]test@holodeck-b2b.org")); }